简体   繁体   中英

Kubectl finding yaml location

So I know how to check the yaml file of my service and deployment which is

$ kubectl get service/helloworld -o yaml
$ kubectl get deployment/helloworld -o yaml

How do I find these files so I could edit them?

I am using minikube if that helps

I would highly recommend you to change .yaml files and apply the resource again.

But if you want for some reason do that on the fly, you can go with:

$ kubectl edit service/helloworld -o yaml
$ kubectl edit deployment/helloworld -o yaml

Why would you want to modify YAML's on the fly? This is prone to errors. If you have any version control in place, you should use that in the first place and build and deploy the artifacts the usual way.

kubectl get deploy deploymentname -o yaml --export

can be used to see the YAML defn alternatively, you can see the file contents. Alternatively, you can also try...

for n in $(kubectl get -o=name pvc,configmap,serviceaccount,secret,ingress,service,deployment,statefulset,hpa,job,cronjob)
 do
   mkdir -p $(dirname $n)
   kubectl get -o=yaml --export $n > $n.yaml
 done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM