| 用途 | 更换工作负载容器镜像(触发滚动更新) |
|---|---|
| 语法 | kubectl set image <资源>/<名称> <容器名>=<镜像> |
常用示例
常用示例
kubectl set image deploy/web web=registry.example.com/app:1.25.3
kubectl set image sts/db db=postgres:16.2 -n prod
kubectl set image deploy/web web=app:1.25.3 --dry-run=client -o yaml > web.yaml
kubectl rollout status deploy/web --timeout=180s容器名取自 spec.template.spec.containers[].name,写错会报 'unable to find container';改完用 rollout status 观察结果。