scholzj / terraform-aws-kubernetes

Terraform module for Kubernetes setup on AWS
Apache License 2.0
202 stars 129 forks source link

The connection to the server localhost:8080 was refused #23

Open SharifAbdulcoder opened 5 years ago

SharifAbdulcoder commented 5 years ago

I'm not sure where the .kube file is saved, i'm able to ssh to my master node but when I run kubectl get nodes i this this messege:

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

so I tried opening the port 8080 but still had the same problem. Am I missing anything?

scholzj commented 5 years ago

That is the error message which you get when there is no configuration at all. When you login to the master, there will be two kubeconfig files:

You can either copy them to local host or use them from the master. To configure kubectl to use them, you can just do export KUBECONFIG=/home/centos/kubeconfig (or whatever the path is.)

SharifAbdulcoder commented 5 years ago

Thank you for getting back so quickly. I did look for the files you suggested:

/home/centos/kubeconfig_ip /home/centos/kubeconfig

i tried finding the kubeconfig file from / and yet it does not exits. Maybe i missed a step?

scholzj commented 5 years ago

If these do not exist in the paths above, maybe the deployment failed for some reason. You should check the log in /var/log/init-aws-kubernetes-master.log. Maybe there is some bug or something.

junyanglee commented 4 years ago

Thank you for getting back so quickly. I did look for the files you suggested:

/home/centos/kubeconfig_ip /home/centos/kubeconfig

i tried finding the kubeconfig file from / and yet it does not exits. Maybe i missed a step?

There's a likelihood that you are using t2.micro instance type as your master node (Happened to me).

If thats the case, remember to add --ignore-preflight-errors=NumCPU behind kubeadm init --config /tmp/kubeadm.yaml in your init-aws-kubernetes-master.sh script because kubernetes require at least 2 cpus.

Cheers