kubectl rollout status 一直挂着,或者 kubectl get pod 看到新旧版本混着跑。

先看状态

kubectl rollout status deployment/app
kubectl get rs
kubectl describe deployment app | tail -20

新 Pod 没 Ready

readinessProbe 一直失败,新 Pod 永远不进 Ready,滚动就停在那。看探针配置的路径和端口对不对,容器里 curl 一下。

maxUnavailable 和 maxSurge

strategy:
  type: RollingUpdate
  rollingUpdate:
    maxUnavailable: 1
    maxSurge: 1

两个都设 0 是非法配置,更新直接卡死。资源紧张时 maxSurge 设 0,先停旧再起新,会有短暂中断。

镜像拉不下来

新版本镜像 tag 不存在,Pod ImagePullBackOff,滚动停住。这种最隐蔽,因为旧 Pod 还在跑,业务看起来正常。

处理

kubectl rollout undo deployment/app
kubectl rollout history deployment/app

先回滚保住业务,再改配置重新发。maxUnavailable 大一点能加快更新,但容量要够。