在kubernetes中有两种负责健康检查的Probe, 分别是Liveness probe 和Readiness Probe 我们最常见到的应该是Liveness probe 例如:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
apiVersion: v1 kind: Pod metadata: labels: test: liveness name: liveness-exec spec: containers: - name: liveness image: k8s.gcr.io/busybox args: - /bin/sh - -c - touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600 livenessProbe: exec: command: - cat - /tmp/healthy initialDelaySeconds: 5 periodSeconds: 5 |
其中periodSeconds 是控制多久执行一次livenessProbe,这个例子中……