I have followed the helloword tutorial on http://kubernetes.io/docs/hellonode/.
When I run:
kubectl run hello-node --image=gcr.io/PROJECT_ID/hello-node:v1 --port=8080
I get:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
Why does the command line try to connect to the localhost?
The hostPort feature allows to expose a single container port on the host IP. Using the hostPort to expose an application to the outside of the Kubernetes cluster has the same drawbacks as the hostNetwork approach discussed in the previous section.
The ports required for a Kubernetes deployment are: 2379/tcp: Kubernetes etcd server client API (on master nodes in multi-master deployments) 2380/tcp: Kubernetes etcd server client API (on master nodes in multi-master deployments) 6443/tcp: Kubernetes API server (master nodes)
This is a common issue when you run the kubectl command or a similar command. In most cases, Kubernetes does not have the correct credentials to access the cluster. It can be easily resolved easily by setting an environment variable in most similar cases.
Access the Kubernetes Dashboard from your browser Then, navigate to: http://127.0.0.1:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ and you should see your Kubernetes dashboard and information.
The issue is that your kubeconfig
is not right. To auto-generate it run:
gcloud container clusters get-credentials "CLUSTER NAME"
This worked for me.
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