How can I edit a Deployment without modify the file manually?

You could do it via the REST API using the PATCH verb. However, an easier way is to use kubectl patch. The following command updates your app’s tag:

kubectl patch deployment myapp-deployment -p \
  '{"spec":{"template":{"spec":{"containers":[{"name":"myapp","image":"172.20.34.206:5000/myapp:img:3.0"}]}}}}'

According to the documentation, YAML format should be accepted as well. See Kubernetes issue #458 though (and in particular this comment) which may hint at a problem.

Leave a Comment