Cannot configure context/ get kubectl working on node01 at Katacoda playground

11/27/2018

$ kubectl config get-contexts returns nothing on node01 in the cluster. I went as far as to set the password on the master node and then ran $ sudo scp -i master@172.17.0.133:/etc/kubernetes/admin.conf ~/.kube/config, but got permission denied. How do I get this working?

-- R678
katacoda
kubernetes
linux

1 Answer

11/28/2018

Here are the steps I followed in order to make it work:

  • sudo su on Node01 and change the password to one of your liking

  • sudo scp /root/admin.conf root@Node01IP:/root/ (you can use Node01 instead of IP)

on Node01:

  • sudo chown $(id -u):$(id -g) $HOME/admin.conf

  • export KUBECONFIG=$HOME/admin.conf

Run kubectl get nodes or kubectl config get-contexts or any kubectl command to verify.

-- aurelius
Source: StackOverflow