Helm command with kubeconfig inline

narcs picture narcs · Mar 17, 2017 · Viewed 9.5k times · Source

I am trying to execute helm commands on VSTS release definition using Run command VSTS extension but the problem is it is not able to find the kubeconfig file on the custom build agent i have configured. I think this is coz the build steps defined run in a separate process. When i run

kubectl config view

It gives me an empty config file. Just wanted to know if i can provide the kubeconfig file inline when m executing helm commands something like

helm init --kubeconfig=kubeconfigpath

Or is there any way i can set the kubeconfig file before running the helm commands in vsts release process?

Appreciate any help. Thanks.

Answer

zaman sakib picture zaman sakib · Jul 24, 2017

'helm init' command discovers your Kubernetes cluster's configuration by reading $KUBECONFIG variable(default '~/.kube/config') and using the default Kubernetes context. If you are using a different config file then you have to change $KUBECONFIG value so that helm gets info about your cluster from the correct config file.

Change the $KUBECONFIG value

export KUBECONFIG=/path_to_your_kubeconfig_file

To be on safe side use the --kube-contex flag to specify the current context

helm init --kube-context CONTEXT_NAME --upgrade

Check helm client and tiller version using

helm version