文档上传网站,公司网站内容更新该怎么做,给我免费播放电影,seo怎么给网站做外链1.容器的健康检查Probe#xff08;探针#xff09;之readinessProbe就绪探针 1.exec方式检查
#通过rc资源创建了三个pod,然后使用services资源#xff0c;对外提供三个pod的容器的访问入口。
apiVersion: v1
kind: ReplicationController
metadata:name: web-rc-readlinepr…1.容器的健康检查Probe探针之readinessProbe就绪探针 1.exec方式检查
#通过rc资源创建了三个pod,然后使用services资源对外提供三个pod的容器的访问入口。
apiVersion: v1
kind: ReplicationController
metadata:name: web-rc-readlineprobe
spec:replicas: 3selector:name: lxczuoyong: webtemplate:metadata:labels:name: lxczuoyong: webspec:zuoyong: webzuoyong: webcontainers:- name: nginximage: harbor.lxcedu.com/base-img/nginx:1.14.2command:- /bin/sh- -c- touch /tmp/healthy; sleep 5; rm -f /tmp/healthy; sleep 60#容器的就绪性检查如果执行command命令成功则标记为未就绪状态readinessProbe:exec:command:- cat- /tmp/healthyfailureThreshold: 3initialDelaySeconds: 15periodSeconds: 1successThreshold: 1timeoutSeconds: 1
---
apiVersion: v1
kind: Service
metadata:name: web-readinessprobenamespace: default
spec:selector:name: lxczuoyong: webtype: ClusterIPports:- port: 80targetPort: 80protocol: TCPreadinessProbe探针如果检查不符合条件pod的状态会变为未就绪如图READY为0/1 通过查询ep和svc也可以看出三个pod处于未就绪状态所以也不会加入web-readinessprobe中所以ep资源就为空kubectl describe ep web-readinessprobe可以看到三个节点都为未就绪状态。 2.httpGet方式检查
把exec检查方法的无关command删除再把里面exec换成下面代码就变成httpGet检查
httpGet:# 指定访问的端口号port: 80# 检测指定的访问路径path: /index.html
启动之后发现pod的容器16秒到17秒状态由未就绪变为就绪说明未检查时容器处于未就绪状态。 删除容器的index.html文件
kubectl exec web-rc-readlineprobe-httpget-hncm4 -- rm /usr/share/nginx/html/index.html
发现对应的pods的容器处于未就绪状态。