Helm command with kubeconfig inline

3/17/2017

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.

-- narcs
azure-pipelines-release-pipeline
deis
kubernetes-helm

3 Answers

3/17/2017

Try to specify kubeconfig file through kubectl command.

kubectl config SUBCOMMAND

Options

-h, --help=false: help for config
      --kubeconfig="": use a particular kubeconfig file

On the other hand, you can try to change build agent account (e.g. your account) and check whether it can find the kubeconfig file (permission issue)

-- starian chen-MSFT
Source: StackOverflow

12/22/2019

I'm playing with WSL 2.0 Ubuntu and use different cloud essential tools installed in Ubuntu distribution.

I easily succeeded to use kubectl with Windows kubeconfig but failed to run any helm version:

kubectl --kubeconfig /mnt/c/Users/Pavel/.kube/config cluster-info

Kubernetes master is running at https://kubernetes.docker.internal:6443 KubeDNS is running at https://kubernetes.docker.internal:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use kubectl cluster-info dump.

kubectl --kubeconfig /mnt/c/Users/Pavel/.kube/config get pods

NAME READY
STATUS RESTARTS AGE freenginx-nginx-ingress-controller-675bd7f48b-szd88 1/1
Running 0 3d22h freenginx-nginx-ingress-default-backend-85c897bdd6-cjk4j 1/1
Running 0 3d22h mysql-1576664918-69dd8486b5-vb44p
1/1 Running 0 4d2h pavel@MSI:~$ helm --kubeconfig /mnt/c/Users/Pavel/.kube/config list Error: unknown flag: --kubeconfig

I expect that helm should behave in the same manner. If I succeed to save long time on double installation of Kubernetes client utilities for users who use WSL 2.0

-- Pavel Sosin
Source: StackOverflow

7/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

-- zaman sakib
Source: StackOverflow