John Fisher
John Fisher

Reputation: 167

How do I update kubernetes deployment image and command?

I see that I can use the "kubectl set image" command to update a container used in a deployment, like this:

kubectl set image deployment/myapp myapp=repo.mycompany.com/myapp/ui:beta.119

But, i would also like to use a different startup command in some situations. Is there a way to update both the image AND the command used for the container?

Upvotes: 1

Views: 902

Answers (1)

Julian Kaffke
Julian Kaffke

Reputation: 428

You could use kubectl patch for that. Run kubectl patch --help to get the docs, but as far as I can tell something like this should do it:

$ kubectl patch deployment <your-deployment> -p '
spec:
  template:
    spec:
      containers:
        - name: <container-name>
          command: ["new", "command"]
' 

Upvotes: 3

Related Questions