How to merge kubectl config file with ~/.kube/config?

前端 未结 6 930
你的背包
你的背包 2020-12-07 16:27

Is there a simple kubectl command to take a kubeconfig file (that contains a cluster+context+user) and merge it into the ~/.kube/config file as an

6条回答
  •  鱼传尺愫
    2020-12-07 17:03

    If you want to merge two config files in a single one

    I found this way (not sure if this is the simplest)

    # Add the two config files to the env var
    export KUBECONFIG=~/.kube/config:~/Desktop/configFile2.yaml
    
    # Review that you have two configurations in one view
    kubectl config view
    
    # View the raw config and output to a new file
    kubectl config view --raw > /tmp/config
    

    Then copy the new config file where you want, also do not forget to unset KUBECONFIG the env variable

提交回复
热议问题