How can I edit a Deployment without modify the file manually?

前端 未结 4 738
情话喂你
情话喂你 2020-12-01 04:18

I have defined a Deployment for my app:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: myapp-deployment
spec:
  replicas: 2
  template:
           


        
4条回答
  •  抹茶落季
    2020-12-01 04:57

    You could do it via the REST API using the PATCH verb. However, an easier way is to use kubectl patch. The following command updates your app's tag:

    kubectl patch deployment myapp-deployment -p \
      '{"spec":{"template":{"spec":{"containers":[{"name":"myapp","image":"172.20.34.206:5000/myapp:img:3.0"}]}}}}'
    

    According to the documentation, YAML format should be accepted as well. See Kubernetes issue #458 though (and in particular this comment) which may hint at a problem.

提交回复
热议问题