0
votes

kubectl get pods -o wide --all-namespaces

it gives kubectl get nodes returns 'The connection to the server 10.xxxxxxxxx was refused. did you specify right host or port?'

kindly do guide.

thanks

1
fix you kubeconfig fileIjaz Ahmad Khan

1 Answers

2
votes

It seems your kubeconfig is not correct after doing kubeadm init, you didnt do the below steps.

Your Kubernetes master has initialized successfully!
To start using your cluster, you need to run (as a regular user):
sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf

Try it and check

If you are on GKE try doing below steps to autogenerate kubeconfig

gcloud container clusters get-credentials "CLUSTER NAME"