For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

kubectl --kubeconfig=/path/to/kubeconfig/file get node

OR

export KUBECONFIG=/path/to/kubeconfig/file 
kubectl get nodes

Last updated