I installed kubectl and k3d after following these official documentations (k3d and kubectl).
I created a cluster with the following command:
k3d cluster create mycluster
Then I ran this command:
kubectl cluster-info
Which gave me this error message:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
After searching I found that the file /etc/kubernetes wasn't created (which means no admin.conf file was created), and the folder ~/.kube also doesn't exist.
PS: see this answer to understand
Here are the versions of k3d and kubectl
$ k3d version
k3d version v5.4.9
k3s version v1.25.7-k3s1 (default)
$ kubectl version --short
Client Version: v1.25.2
Kustomize Version: v4.5.7
Check Kubeadm was properly installed or not?. The command
kubeadm versionhelps you to know the running status of kubeadm.Note : If you can see the kubeadm version number, your kubeadm was installed properly.
And also run
kubeadm initto initialize the control plane on your machine and create the necessary configuration files. See Kubernetes Community forum issue for more information.See Nijo Luca’s blog on k21 academy for more information, which may help to resolve your issue.