3
votes

I am following the hellonode tutorial on kubernetes.io

http://kubernetes.io/docs/hellonode/

I am getting an error when trying to do the 'Create your pod' section.

When I run this command (replacing PROJECT_ID with the one I created) I get the following:

$ kubectl run hello-node --image=gcr.io/PROJECT_ID/hello-node:v1 --port=8080

The connection to the server localhost:8080 was refused - did you specify the right host or port?

I get a similar error just typing kubectl version:

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.2", GitCommit:"528f879e7d3790ea4287687ef0ab3f2a01cc2718", GitTreeState:"clean"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?

I'm not sure what to do since I have no experience with kubernetes other than following the steps of this tutorial.

1

1 Answers

5
votes

I figured out the issue. In the Create your cluster section I missed a critical step.

The step I missed was: Please ensure that you have configured kubectl to use the cluster you just created. The configured part is a link to how to do this:

The steps are as follows:

gcloud config set project PROJECT
gcloud config set compute/zone ZONE
gcloud config set container/cluster CLUSTER_NAME
gcloud container clusters get-credentials CUSTER_NAME