I tried to install kubectl on popos using the following commands
sudo apt install -y ca-certificates curl apt-transport-https
sudo curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update
sudo apt install -y kubectl
After the installation kubectl cluster-info
give me that
kalin@pop-os:~$ kubectl cluster-info
E0304 00:04:05.721040 93361 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0304 00:04:05.721478 93361 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0304 00:04:05.722950 93361 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0304 00:04:05.724685 93361 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0304 00:04:05.726373 93361 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server localhost:8080 was refused - did you specify the right host or port?
helm status RELEASE_NAME give me that
kalin@pop-os:~$ helm status RELEASE_NAME
Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version": dial tcp [::1]:8080: connect: connection refused
Not sure if that is the reason but it’s turnout that I don’t have ~/.kube/config
or /etc/kubernetes/admin.conf
. I made a lot of google searches but at that point I surrender
2
Answers
It's turnout that the installation of kubectl don't provide kubernetes cluster itself. After some googling I find out that I need to install more components on my system. There are at least 4 possible options for local kubernetes cluster
It seems that minikube is the simplest and I didn't explore the rest. Also if you install minukube you may not need to install kubectl because minikube provide one
What is your version of
k8s
?Port 8080 is not supported in higher versions, you need to use 6443.
kubectl
version andk8s
versionAre kubelet and kube-apiserver compatible ?
https://kubernetes.io/releases/version-skew-policy/#kubelet
If your configuration file is in the correct location, the kubectl version is also correct. You can troubleshoot this in the way given below