I'm creating a kubernetes deployment using the following command:
kubectl run my-app --image=ecr.us-east-1.amazonaws.com/my-app:v1 -l name=my-app --replicas=1
Now I want to update my-app
to v2. Following this blog post it seems the recommended way is to use:
kubectl edit deployment/my-app
The problem is this wants to open a text editor so Im not sure how I can automate this task in my continuous deployment environment. Ideally, I'd like to run a command something like:
kubectl edit deployment/update --image=ecr.us-east-1.amazonaws.com/my-app:v2
How can I script this so that it doesn't open the text editor?
Please see my answer to the very similar question How can I edit a Deployment without modify the file manually?. It involves running kubectl patch
.