First, make sure you’ve set the KUBECONFIG environment variable to point to the correct config file for the project you’re working on:
export KUBECONFIG=~/path/to/kubeconfig.yamlVerify that you’re connected to the right cluster by checking the current context:
kubectl config current-contextThis command should output the name of the current context specified in your kubeconfig.yaml.
Display information about your Kubernetes cluster:
$ kubectl cluster-info
Kubernetes control plane is running at https://redacted
CoreDNS is running at https://redacted-proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.$ kubectl -n [namespace] get nodes
NAME STATUS ROLES AGE VERSION
default-node-pool-qwer3 Ready <none> 24 v1.00.1
default-node-pool-qwer7 Ready <none> 24 v1.00.1$ kubectl -n [namespace] get pods
No resources found in default namespace.$ kubectl -n [namespace] get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 00.000.0.1 <none> 443/TCP 24d$ kubectl -n [namespace] exec -it <pod-name> -- bashThis command is particularly useful for debugging issues directly inside the container or running management commands.