• k8s-merge-robot's avatar
    Merge pull request #25509 from janetkuo/kubectl-set-image · 2c471bce
    k8s-merge-robot authored
    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 
    
    
    [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
    2c471bce
Name
Last commit
Last update
..
cmd Loading commit data...
resource Loading commit data...
testing Loading commit data...
OWNERS Loading commit data...
apply.go Loading commit data...
autoscale.go Loading commit data...
bash_comp_utils.go Loading commit data...
configmap.go Loading commit data...
configmap_test.go Loading commit data...
custom_column_printer.go Loading commit data...
custom_column_printer_test.go Loading commit data...
describe.go Loading commit data...
describe_test.go Loading commit data...
doc.go Loading commit data...
explain.go Loading commit data...
generate.go Loading commit data...
generate_test.go Loading commit data...
history.go Loading commit data...
interfaces.go Loading commit data...
kubectl.go Loading commit data...
kubectl_test.go Loading commit data...
namespace.go Loading commit data...
namespace_test.go Loading commit data...
proxy_server.go Loading commit data...
proxy_server_test.go Loading commit data...
resource_printer.go Loading commit data...
resource_printer_test.go Loading commit data...
rollback.go Loading commit data...
rolling_updater.go Loading commit data...
rolling_updater_test.go Loading commit data...
rollout_status.go Loading commit data...
run.go Loading commit data...
run_test.go Loading commit data...
scale.go Loading commit data...
scale_test.go Loading commit data...
secret.go Loading commit data...
secret_for_docker_registry.go Loading commit data...
secret_for_docker_registry_test.go Loading commit data...
secret_test.go Loading commit data...
service.go Loading commit data...
service_test.go Loading commit data...
serviceaccount.go Loading commit data...
serviceaccount_test.go Loading commit data...
sorted_event_list.go Loading commit data...
sorted_event_list_test.go Loading commit data...
sorted_resource_name_list.go Loading commit data...
sorting_printer.go Loading commit data...
sorting_printer_test.go Loading commit data...
stop.go Loading commit data...
stop_test.go Loading commit data...
version.go Loading commit data...
watchloop.go Loading commit data...