Kubernetes on AWS using Kops - kube-apiserver authentication for kubectl

12/14/2018

I have setup a basic 2 node k8s cluster on AWS using KOPS .. I had issues connecting and interacting with the cluster using kubectl ... and I keep getting the error: The connection to the server api.euwest2.dev.avi.k8s.com was refused - did you specify the right host or port? when trying to run any kubectl command .....

have done basic kops export kubecfg --name xyz.hhh.kjh.k8s.com --config=~$KUBECONFIG --> to export the kubeconfig for the cluster I have created. Not sure what else I'm missing to make a successful connection to the kubeapi-server to make kubectl work ?

-- Avi
amazon-web-services
kops
kubernetes

1 Answer

12/16/2018

Sounds like either:

  • Your kube-apiserver is not running.
    • Check with docker ps -a | grep apiserver on your Kubernetes master.
  • api.euwest2.dev.avi.k8s.com is resolving to an IP address where your nothing is listening.
    • 208.73.210.217?
  • You have the wrong port configured for your kube-apiserver on your ~/.kube/config
    • server: https://api.euwest2.dev.avi.k8s.com:6443?
-- Rico
Source: StackOverflow