Kubectl Commands Not Working After v1.20 Cluster Upgrade
Problem
After upgrading our cluster to v1.20, kubectl command returns connection refused message:
The connection to the server localhost:8080 was refused - did you specify the right host or port?Environment
- Platform9 Managed Kubernetes - v5.2 and Higher
- Cluster running on v1.20
Cause
This is an expected behavior from Kubernetes version v1.20
Resolution
- A KUBECONFIG environment variable will have to be explicitly sourced or the kubeconfig file needs to be specified via command line option --kubeconfig on the master nodes for kubectl to work.
Sample commands
x
kubectl --kubeconfig=/path/to/kubeconfig/file get nodeORexport KUBECONFIG=/path/to/kubeconfig/file kubectl get nodes It is also recommended to use the kubeconfig assigned to users instead of using the file at /etc/pf9/kube.d/kubeconfigs/admin.yaml since it has blanket elevated permissions.
Was this page helpful?