What is the optimal way to Deployment in K8S?

2/2/2019

There is a K8S cluster, and most of our Deployments are just updating image's version, but sometimes we'd like to update some parts of Deployment configuration as well. Our Deployment config doesn't include images' tags.

For updating image version kubectl set image seems me the best option. As for updating Deployment configuration and image together, I see a few ways:

  • kubectl deploy ... : kubectl set image ... [but there are two Deployments]
  • editing Deployment YAML with actual image tag [seems me less elegant]
  • kubectl patch [but for this we should prepare separate patch YAML?]

What do you suggest? TIA, Vitaly

-- Vitaly
kubectl
kubernetes

2 Answers

2/2/2019

Honestly, the thing is up to you that what you like.

  • If you don't like having two versions of your Deployment, then don't use kubectl set image ....
  • If you don't like to bother with preparing patch string for kubectl patch ... command then don't do it too.
  • So just edit the existing Deployment one. You can use kubectl edit ... command or kubectl apply -f path/to/your_deployment_configuration_file.
-- Shudipta Sharma
Source: StackOverflow

2/2/2019

Edit the deployment yam file and update the image. Use - - record option with deployment command to track the deployment history.

-- P Ekambaram
Source: StackOverflow