AWS kubectl: Unable to connect to the server: EOF

10/28/2018

I'm new to Kubernetes and trying to create a cluster on AWS. I haven't been able to run the kubectl command and getting the Unable to connect the server: EOF

I have been trying various forums and help for the last 2 days, but not sure what am missing.

Steps:

I have launched a t2.micro Ubuntu EC2 instance.

Here are the details of the software installed:

$ kops version
Version 1.10.0 (git-8b52ea6d1)

$ aws --version
aws-cli/1.16.43 Python/3.6.6 Linux/4.15.0-1021-aws botocore/1.12.33

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.2", 
GitCommit:"17c77c7898218073f14c8d573582e8d2313dc740", GitTreeState:"clean", 
BuildDate:"2018-10-24T06:54:59Z", GoVersion:"go1.10.4", Compiler:"gc", 
Platform:"linux/amd64"}
Unable to connect to the server: EOF

I create the cluster after defining the AWS Access key / secret key and S3 bucket:

 $ kops create cluster clusters.k8s.local --zones us-east-1a --ssh-public-key kubernetes.pub --yes

I get the following output:

$ kops create cluster clusters.k8s.local --zones us-east-1a --ssh-public-key kubernetes.pub --yes
I1028 15:07:44.695579   10142 create_cluster.go:1351] Using SSH public key: kubernetes.pub
I1028 15:07:45.604469   10142 create_cluster.go:480] Inferred --cloud=aws from zone "us-east-1a"
I1028 15:07:46.037436   10142 subnets.go:184] Assigned CIDR 172.20.32.0/19 to subnet us-east-1a
I1028 15:07:49.847838   10142 apply_cluster.go:505] Gossip DNS: skipping DNS validation
I1028 15:07:50.474329   10142 executor.go:103] Tasks: 0 done / 77 total; 30 can run
I1028 15:07:51.670973   10142 vfs_castore.go:735] Issuing new certificate: "apiserver-aggregator-ca"
I1028 15:07:51.819791   10142 vfs_castore.go:735] Issuing new certificate: "ca"
I1028 15:07:52.756166   10142 executor.go:103] Tasks: 30 done / 77 total; 24 can run
I1028 15:07:54.645080   10142 vfs_castore.go:735] Issuing new certificate: "apiserver-proxy-client"
I1028 15:07:55.018900   10142 vfs_castore.go:735] Issuing new certificate: "apiserver-aggregator"
I1028 15:07:55.250726   10142 vfs_castore.go:735] Issuing new certificate: "kube-proxy"
I1028 15:07:55.295112   10142 vfs_castore.go:735] Issuing new certificate: "kube-scheduler"
I1028 15:07:55.381353   10142 vfs_castore.go:735] Issuing new certificate: "kube-controller-manager"
I1028 15:07:55.646626   10142 vfs_castore.go:735] Issuing new certificate: "kops"
I1028 15:07:56.694727   10142 vfs_castore.go:735] Issuing new certificate: "kubecfg"
I1028 15:07:56.837301   10142 vfs_castore.go:735] Issuing new certificate: "kubelet-api"
I1028 15:07:56.955183   10142 vfs_castore.go:735] Issuing new certificate: "kubelet"
I1028 15:07:57.546052   10142 executor.go:103] Tasks: 54 done / 77 total; 19 can run
I1028 15:07:59.426632   10142 executor.go:103] Tasks: 73 done / 77 total; 3 can run
I1028 15:08:00.563120   10142 vfs_castore.go:735] Issuing new certificate: "master"
I1028 15:08:01.146029   10142 executor.go:103] Tasks: 76 done / 77 total; 1 can run
I1028 15:08:01.784444   10142 executor.go:103] Tasks: 77 done / 77 total; 0 can run
I1028 15:08:01.937677   10142 update_cluster.go:290] Exporting kubecfg for cluster
kops has set your kubectl context to clusters.k8s.local

Cluster is starting.  It should be ready in a few minutes.

Suggestions:
* validate cluster: kops validate cluster
* list nodes: kubectl get nodes --show-labels
* ssh to the master: ssh -i ~/.ssh/id_rsa admin@api.clusters.k8s.local
* the admin user is specific to Debian. If not using Debian please use the appropriate user based on your OS.   
* read about installing addons at: https://github.com/kubernetes/kops/blob/master/docs/addons.md.

I see the clusters.k8s.local created under my S3 bucket.

$ kubectl cluster-info

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Unable to connect to the server: EOF

Validate kops cluster:

$ kops validate cluster
Using cluster from kubectl context: clusters.k8s.local

Validating cluster clusters.k8s.local


unexpected error during validation: error listing nodes: Get https://api-clusters-k8s-local-k5ptn2-2092608752.us-east-1.elb.amazonaws.com/api/v1/nodes: EOF

When I run the nslookup command:

$ nslookup clusters.k8s.local
Server:         127.0.0.53
Address:        127.0.0.53#53

** server can't find clusters.k8s.local: SERVFAIL
-- Sai
amazon-web-services
kops
kubectl
kubernetes

0 Answers