我试图按照此文档在我的 pod 上启用就绪性和活跃度探测,以进行集群中的运行状况检查,但是它给了我一个错误,即连接拒绝容器 IP 和端口。我添加了就绪性和活跃性的部分如下。
我使用 helm 进行部署,我尝试监控的端口是 80。下面还给出了入口的服务文件。
https://learn.microsoft.com/en-us/azure/application-gateway/ingress-controller-add-health-probes
服务.yaml
apiVersion: v1
kind: Service
metadata:
name: expose-portal
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "{{ .Values.isInternal }}"
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: portal
部署.yaml
spec:
containers:
- name: App-server-portal
image: myacr-app-image-:{{ .Values.image_tag }}
imagePullPolicy: Always
ports:
- name: http
containerPort: 80
protocol: TCP
readinessProbe:
httpGet:
path: /
port: 80
periodSeconds: 3
timeoutSeconds: 1
livenessProbe:
httpGet:
path: /
port: 80
periodSeconds: 3
timeoutSeconds: 1
volumeMounts:
- mountPath: /etc/nginx
readOnly: true
name: mynewsite
imagePullSecrets:
- name: my-secret
volumes:
- name: mynewsite.conf
configMap:
name: mynewsite.conf
items:
- key: mynewsite.conf
path: mynewsite.conf
我在这里做错了什么吗?根据截至目前的 Azure 文档,目前不支持在 Pod 上公开的端口以外的端口上进行探测。我的理解是我的 pod 上的端口 80 已经暴露了。
最佳答案
取自文档:
- initialDelaySeconds:容器启动后启动事件或就绪探测之前的秒数。默认为 0 秒。最小值为 0。
- periodSeconds:执行探测的频率(以秒为单位)。默认为 10 秒。最小值为 1。
- timeoutSeconds:探测超时之前的秒数。默认为 1 秒。最小值为 1。
解决方案是增加超时。
PS。我认为您可能需要引入initialDelaySeconds
而不是将超时增加到 3 分钟
关于azure - 在 Azure AKS 中实现就绪性和活跃度探测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59794286/