5

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
Rico
  • 58,485
  • 12
  • 111
  • 141
Sai
  • 309
  • 1
  • 4
  • 15
  • 1
    The endpoint is not `clusters.k8s.local`. it's `api-clusters-k8s-local-k5ptn2-2092608752.us-east-1.elb.amazonaws.com`. That's an ELB, can you check the status of the elb on your AWS console? Also check that all the nodes are up and running on the EC2 console. – Rico Oct 28 '18 at 17:51
  • I see there is a Load Balancer created. I also see 2 volumes & security groups created, I suppose 1 for master and another for node. When I run "kops get cluster" command, I see the cluster information displayed. However I don't see any EC2 running instances created neither for master or node. Also, whenever I run the "kubectl validate cluster" command, I always get "unexpected error during validation: error listing nodes:" With kubectl cluster-info I get "Unable to connect to the server: EOF" – Sai Oct 30 '18 at 04:28
  • 1
    Maybe it’s in a different region? – Rico Nov 01 '18 at 05:35
  • 1
    Thanks Rico..you are right. It was in a different region, now I changed the cluster to spin up in the same region. Also I had to raise my EC2 service limits to 5 t2.micro. Now this got resolved. Thanks for your help! – Sai Nov 02 '18 at 18:28
  • hi i have same error,, umm my region `master instance` is ap-northeast-2c, `node instance` ap-northeast-2c too... and my ubuntu instance(installed kops and kubectl) is ap-northeast-2c,,, but raise all same error ... i need some help thank you – Jade Han Dec 08 '18 at 06:31
  • I don't think you followed kops instructions for DNS types. You have a local cluster it seems you are connecting to AWS? Also, for others that get here, you may just need to wait for DNS to update. See your Route 53 table for "api.CLUSTER" ex "api.mycluster.mydomain.com". It should point to an ELB and if your local computer does not resolve that URL to that ELB, then kubectl will give this error. – cwingrav Feb 11 '19 at 16:40

0 Answers0