报错与对策
报错与对策
kubectl apply -f deploy.yaml
# 输出示例:
# Operation cannot be fulfilled on deployments.apps "web": the object has been
# modified; please apply your changes to the latest version and try again
kubectl get deploy web -o yaml > web.yaml
kubectl apply -f web.yaml这是乐观锁机制:读取版本 → 基于该版本修改 → 带版本写回;控制器代码遇到 409 应重新读取再重试。