I am going through the kubernetes tutorial at Udacity. When i run the the nginx image using the following command
kubectl run nginx --image=nginx:1.10.0
It given me the error
error: failed to discover supported resources: Get http://localhost:8080/apis/extensions/v1beta1: dial tcp 127.0.0.1:8080: getsockopt: connection refused
If i try to get pods using the following command
kubectl get pods
it says
The connection to the server localhost:8080 was refused - did you specify the right host or port?
The nginx server is running, i can tell because i can get the appropriate output by running curl http://127.0.0.1
I am not able to figure out what the issue is, and there are not a lot of resources on the internet for this problem. Can anyone please tell me how do i resolve it?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With