kubectl get nodes not returning any result

2/7/2021

Issue: kubectl get nodes, returning an empty result

Cloud provider: Azure

K8s cluster built from scratch with VMSS instances/VMs

<pre>azureuser@khway-vms000000:~$ kubectl get no No resources found in default namespace.</pre>

I am a bit stuck and do not know what else I could check to get to the bottom of this issue.

Thanks in advance!

-- Catalin
azure
kubernetes

1 Answer

2/7/2021

it seems like you logged on to one of the nodes of the managed VMSS.

Instead do (e.g. from your dev machine):

az aks get-credentials --name MyManagedCluster --resource-group MyResourceGroup

https://docs.microsoft.com/en-us/cli/azure/aks?view=azure-cli-latest#az_aks_get_credentials

then you can run kubectl

-- silent
Source: StackOverflow