mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-04 09:36:16 +00:00
Automatic merge from submit-queue Add 'kubectl set image' ```release-note Add "kubectl set image" for easier updating container images (for pods or resources with pod templates). ``` **Usage:** ``` kubectl set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N ``` **Example:** ```console # Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'. $ kubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1 # Update all deployments' nginx container's image to 'nginx:1.9.1' $ kubectl set image deployments nginx=nginx:1.9.1 --all # Update image of all containers of daemonset abc to 'nginx:1.9.1' $ kubectl set image daemonset abc *=nginx:1.9.1 # Print result (in yaml format) of updating nginx container image from local file, without hitting the server $ kubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml ``` I abandoned the `--container=xxx --image=xxx` flags in the [deploy proposal](https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/deploy.md#kubectl-set) since it's much easier to use with just KEY=VALUE (CONTAINER_NAME=CONTAINER_IMAGE) pairs. Ref #21648 @kubernetes/kubectl @bgrant0607 @kubernetes/sig-config []()