Let's say you have been given a Kubernetes cluster and you have access to the node. This is the first time you have logged into the master node and now you want to fetch all the details related to installed Kubernetes cluster.
In this article we are going to discuss what are the commands that can be used to get the details of the installed Kubernetes cluster.
1. Cluster Information
To get the cluster information, below command can be used:
# kubectl cluster-info
Above command display addresses of the master and services as shown below:
To get more details about the cluster one more parameter can be added in the same command :
# kubectl cluster-info dump
2. Node Information
Another piece of information that you may need to know is, how many nodes are there which are part of kubernetes cluster. You can use below command to get the details :
# kubectl get nodes
For example: The above output shows our cluster contains only one node.
3. Kubernetes Version Information
The above command output has VERSION column which tells the kubernetes version installed. As shown in above screenshot, this cluster has kubernetes version v1.17.0
4. Detailed Information
When same command gets executed with added parameter '-o wide', it gives you more information about the nodes, e.g. Node IP, Node OS, Node Kernel Version etc.
# kubectl get nodes -o wide
5. Cluster Components
Depending on the setup, kubernetes master components might be running as PODs, hence you can execute below commands to know the details :
# kubectl get pods -n kube-system