I am new to Kubernetes. I recently installed kubectl
in my ubuntu machine(A VMware vm) with architecture x86_64.operating system is ubuntu 16.04.Installation steps followed:
#curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
#chmod +x ./kubectl
#sudo mv ./kubectl /usr/local/bin/kubectl
However when I run kubectl get nodes It shows error:
The connection to the server localhost:8080 was refused-did you specify right host or port?
What am I missing?
Are you trying to connect to a remote Kubernetes cluster? If yes you need a config file containing the connection (and authentication) details. kubectl
expects this file to be present at ~/.kube/config
. Your cluster admins should be able to provide you that file.
If you are not connecting to a remote Kubernetes cluster, then you must run the cluster on your own machine using minikube or any other alternative.
The error is because you don't have any kubernetes cluster running.
You can install Minikube and use it to setup a single node cluster on your local machine
If you are using AWS as a cloud provider, you can install kops and use it to setup multi node kubernetes cluster in aws.
When you have a cluster running, you can then run the command and get nodes running in the cluster returned