Container 的主行程還在就算活著。但實際上一個程式可能行程沒死、卻已經卡住不回應了,這種狀況 K8s 完全看不出來,還是會把流量送過去
改 deployment.yaml,在 container 底下加
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 3
periodSeconds: 5
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
periodSeconds: 10
failureThreshold: 3
除了 httpGet,還有 tcpSocket 跟 exec 兩種方式
kubectl apply -f manifests/base
kubectl rollout status deployment/web -n ithome-lab
kubectl get pods -n ithome-lab

READY 前面那個 1 是通過 Readiness 檢查的 Container 數,後面是總數。之前沒設 Probe 的時候它永遠是 1/1,現在代表通過檢查
describe 也看得到設定
kubectl describe pod -n ithome-lab -l app=web

先這樣,明天見 :D
