在 Azure AKS 中实施就绪性和活性探测
Implementing Readiness and Liveness probe in Azure AKS
我正在尝试按照此文档在我的 pods 上启用就绪性和活动性探测,以便在我的集群中进行健康检查,但是它给了我一个错误,即拒绝连接到容器 IP 和端口。下面是我添加准备和活跃度的部分。
我正在使用helm进行部署,我试图监控的端口是80。下面也给出了ingress的服务文件。
https://docs.microsoft.com/en-us/azure/application-gateway/ingress-controller-add-health-probes
Service.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
Deployment.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 分钟
我正在尝试按照此文档在我的 pods 上启用就绪性和活动性探测,以便在我的集群中进行健康检查,但是它给了我一个错误,即拒绝连接到容器 IP 和端口。下面是我添加准备和活跃度的部分。
我正在使用helm进行部署,我试图监控的端口是80。下面也给出了ingress的服务文件。
https://docs.microsoft.com/en-us/azure/application-gateway/ingress-controller-add-health-probes
Service.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
Deployment.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 分钟