Oct 25, 2020
Set k8s deployment env with kubectl
You can add new env or update existing env with kubectl set env
command. Is the env is existed, the value will be updated, if not it will be created.
kubectl set env -n myns deployment/mydeployment MY_ENV=MYVALUE
deployment.apps/mydeploymen env updatedkubectl set env -n myns deployment/mydeployment --list |grep MY_ENV
MY_ENV=MYVALUE
If you set imagePullPolicy: Always
you can force to fetch latest image withkubectl rollout restart deployment
kubectl -n myns rollout restart deployment mydeployment
If you want to update image tag use the following command before rollout restart
kubectl -n myns set image deployment mypp=myecrid.dkr.ecr.eu-west-1.amazonaws.com/myapp:tagvale
Ismail Yenigul