Kubernetes failed to discover supported resources: getsockopt: connection refused

This issue often occurs when kubectl can not find the configuration credential for the intended cluster.

Check $HOME/.kube/config for cluster configuration. If configuration is empty or configuration is set for a wrong cluster, regenerate configuration by running,

gcloud container clusters get-credentials <CLUSTER_NAME> --zone <ZONE>

This will update the configuration credential in $HOME/.kube/config.

Now, everything should work as expected.

Reference: https://github.com/googlecodelabs/feedback/issues/537


Check your kubectl config file (~/.kube/config)

For testing purposes, you can use the admin one:

kubectl --kubeconfig /etc/kubernetes/admin.conf get po

Or (again, for testing)

sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf

You can see more suggestions in kubernetes/kubernetes issue 23726

As commented below, that requires kubernetes to be installed, for the node to be able to join a cluster:

sudo kubeadm join --token TOKEN MASTER_IP:6443