liveBook · Manning

Kubectl set image

As explained in Kubernetes in Action, Second Edition

kubectl set image is a kubectl command that changes the container image used by containers in Kubernetes resources.

kubectl set image changes the container image in a Kubernetes API object. It provides a quick alternative to editing or applying an entire manifest when only the image needs changing. section 15.2.1

Update a Deployment image

Run `kubectl set image deployment kiada kiada=luksa/kiada:0.6` to change the `kiada` container in the `kiada` Deployment to image version 0.6. section 15.2.1

The command can change a container image in objects that include containers, including Deployments, ReplicaSets, and Pods. If a Pod template also stores the application version in labels, changing only the image can leave the image and label inconsistent; use kubectl patch when both fields must change. section 15.2.1

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains the command, supported objects, and label-consistency caveat, but defers detailed command syntax.
Examples
Demonstrates updating the kiada Deployment from luksa/kiada:0.5 to luksa/kiada:0.6.
What it assumes
Assumes familiarity with Kubernetes resources, containers, images, Deployments, and manifests.
What you can do after
Apply it via kubectl set image to update a named container image in a Kubernetes resource.
How it connects
Connects container images with Deployments, ReplicaSets, Pods, Pod templates, labels, and kubectl patch.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.