0
votes

Kubernetes newbie question: Can I somehow include my pod definition inside my deployment definition?

I currently have a pod.yml, a service.yml and a deployment.yml file. Both in pod.yml and deployment.yml I specify my docker image and tag: user/image:v1.

To do a rolling update, I tried doing kubectl set image deployment/api api=user/image:v2

However, that doesnt work alone.. It seems to conflict with the image tag in the pod definition. I need to also update the pod with tag v2 for kubectl set image to work.. I feel like I'm doing something wrong. Thoughts?

1

1 Answers

0
votes

Yes, you can include all definitions in one file. Have a look at the guestbook-all-in-one.yaml example.

The recommended way to do a rolling update is to change the file and then use apply:

$ vim guestbook-all-in-one.yaml  # make the desired changes
$ kubectl apply -f guestbook-all-in-one.yaml  # apply these changes

If possible, you should also have this file under version control, so that the file with the current status is always easily accessible.