Get YAML for deployed Kubernetes services?

前端 未结 12 1573
离开以前
离开以前 2020-12-22 23:28

I am trying to deploy my app to Kubernetes running in Google Container Engine.

The app can be found at: https://github.com/Industrial/docker-znc.

12条回答
  •  佛祖请我去吃肉
    2020-12-22 23:52

    How do I get the YAML for the Deployment, Service and Pod created by Kubernetes by filling in the form?

    kubectl get deployment,service,pod yourapp -o yaml --export
    

    Answering @Sinaesthetic question:

    any idea how to do it for the full cluster (all deployments)?

    kubectl get deploy --all-namespaces -o yaml --export
    

    The problem with this method is that export doesn't include the namespace. So if you want to export many resources at the same time, I recommend doing it per namespace:

    kubectl get deploy,sts,svc,configmap,secret -n default -o yaml --export > default.yaml
    

    Unfortunately kubernetes still doesn't support a true get all command, so you need to list manually the type of resources you want to export. You can get a list of resource types with

    kubectl api-resources
    

提交回复
热议问题