3
votes

I've setup a K8s cluster and got the config file which I have placed in the username/.kube directory

I can't seem to workout how to link my Powershell Kubectl to this config file by default. For instance if I try and run the following command I don't get the cluster I've setup.

kubectl config get-contexts

If however, I run the following command, I do get a list of my current nodes

kubectl --kubeconfig="cluster-kubeconfig.yaml" get nodes
1
It seems your ...username/.kube/config file is not configured in proper way. Better if you provide the contents of both of the files ...username/.kube/config and cluster-kubeconfig.yaml. Be aware of printing the credentials of the cluster.Shudipta Sharma

1 Answers

5
votes

Copy contents of cluster-kubeconfig.yaml file to $HOME/.kube/config

This will be the default kubernetes context file.

You can also override and point to any other custom kubernetes context using

 $Env:KUBECONFIG=("/path/to/cluster-kubeconfig.yaml")

as mentioned here.

For more info check this out.

Hope this helps.