Connection refused with kubectl on EC2 ubuntu instance?

8/17/2016

I installed docker-go-kubernetes on an ubuntu EC2 AWS instance using this guide: http://kubernetes.io/docs/getting-started-guides/aws/

I have kubectl installed but when I run a test: kubectl run my-nginx --image=nginx --replicas=2 --port=80

I receive and error:

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

How do I specify the host or port?

-- Nicky Feller
amazon-web-services
docker
kubernetes

1 Answer

8/18/2016

It looks like you didn't configure your kubectl.

You need to either place proper kubeconfig into ~/.kube/config or provide in during call like:

kubectl --kubeconfig=kubeconfig run my-nginx --image=nginx --replicas=2 --port=80

-- lwolf
Source: StackOverflow