How to describe entire cluster (Nodes running and individual node basic information, we get with kubectl describe nodes)in Kubernetes maintenance?

4/25/2021

Kubectl describe nodes ? like wise do we have any commands like mentioned below to describe cluster information ?

kubectl describe cluster

-- AkhilKarumanchi
kubernetes

1 Answer

4/25/2021

"Kubectl describe <api-resource_type> <api_resource_name> "command is used to describe a specific resources running in your kubernetes cluster, Actually you need to verify different components separately as a developer to check your pods, nodes services and other tools that you have applied/created.

If you are the cluster administrator and you are asking about useful command to check the actual kube-system configuration it depends on your k8s cluster type for example if you are using "kubeadm" package to initialize k8s cluster on premises you can check and change the default cluster configuration using this command :

kubeadm config print init-defaults 

after initializing your cluster all main server configurations files a.k.a manifests are located here /etc/kubernetes/manifests (and they are Realtime updated, change anything and the cluster will redeploy it automatically)

Useful kubectl commands :

For cluster infos (api-server domain and dns) run:

kubectl cluster-info

Either ways you can list all api-resources and check it one by one using these commands

kuectl api-resources (list all api-resources names and types)
kubectl get <api_resource_name> (specific to your cluster)
kubectl explain <api_resource_name> (explain the resource object with docs link)

For extra infos you can add specific flags, examples:

kubectl get nodes -o wide
kubectl get pods -n <specific-name-space> -o wide
kubectl describe pods <pod_name> 
...

For more informations about the kubectl command line check the kubectl_cheatsheet

-- Hajed.Kh
Source: StackOverflow