1.修改配置文件
sed -i 's/nginx:v1/nginx:v2/g' image_update.yaml
重新应用配置文件
kubectl apply -f image_update.yaml
kubectl get pod -o wide
2.使用patch命令
首先找的deployment
kubectl get deploy
通过patch更新
kubectl patch deployment deployment名
--patch '{"spec": {"template": {"spec": {"containers": [{"name": "nginx","image":"新image"}]}}}}'
3.使用set image 命令
kubectl set image deploy image-deployment *=registry.cn-beijing.aliyuncs.com/mrvolleyball/nginx:v2
来源:oschina
链接:https://my.oschina.net/u/3966437/blog/4498784