kURL: Setting kubectl config correctly inside a kURL control plane node

When in a kURL control plane node, at times when you run kubectl commands such as kubectl get pods, you might get errors that indicate that you either cannot connect to the cluster (The connection to the server localhost:8080 was refused - did you specify the right host or port?) or are not authenticated. This might be because you do not have your kubectl config setup correctly. To set it up correctly, please do the following.

NOTE: This commands assume a you are on a *nix environment, which is all that kURL currently supports

  • Ensure you can successfully run kubectl commands using /etc/kubernetes/admin.conf config
sudo kubectl --kubeconfig /etc/kubernetes/admin.conf get pods
  • Copy the config to your ~/.kube directory
mkdir -p .kube/ && sudo cp /etc/kubernetes/admin.conf .kube/config && sudo chown $USER:$USER .kube/config
  • Clear any KUBECONFIG environment variables that may have been set prior
unset KUBECONFIG
  • (Optional) for good measure, log out and log back into the node
1 Like