docker image to query information from a MKE cluster based off of alpine:latest
To pull this image:
docker pull mirantis/kubernetes-cluster-info
There are two methods to run this container:
-
On the cluster - Run it directly on a manager via a client bundle (requires image pull access from Docker Hub)
-
On a local engine - Run it on a local machine (such as Docker Desktop) and communicate to the MKE APIs using a client bundle
If you are running in a secured environment or use Docker Content Trust policy enforcement, you'll want to choose the 2nd option. The first option is the quickest due to all API calls going over the Docker socket of a manager instead of across the MKE APIs but the 2nd option will not run any containers in your environment.
-
Load a MKE client bundle (or skip the client bundle and run the command directly on a manager)
-
Run the container:
docker run -t --rm --name kubernetes-cluster-info \ -v /var/run/docker.sock:/var/run/docker.sock \ -e affinity:container==ucp-controller \ mirantis/kubernetes-cluster-info
-
Data will be returned:
$ docker run -t --rm --name kubernetes-cluster-info \ -v /var/run/docker.sock:/var/run/docker.sock \ -e affinity:container==ucp-controller \ mirantis/kubernetes-cluster-info ======================== Data for all nodes: 2 Core x 4 4 Core x 11 # Nodes - 15 Ttl Core - 52 Min Core - 2 Max Core - 4 Avg Core - 3.46 ======================== Data for manager nodes: 4 Core x 3 # Nodes - 3 Ttl Core - 12 Min Core - 4 Max Core - 4 Avg Core - 4.00 ======================== Data for worker nodes: 2 Core x 4 4 Core x 8 # Nodes - 12 Ttl Core - 40 Min Core - 2 Max Core - 4 Avg Core - 3.33 ======================== Data for all nodes running linux: 2 Core x 4 4 Core x 9 # Nodes - 13 Ttl Core - 44 Min Core - 2 Max Core - 4 Avg Core - 3.38 ======================== Data for all nodes running windows: 4 Core x 2 # Nodes - 2 Ttl Core - 8 Min Core - 4 Max Core - 4 Avg Core - 4.00 ========================
In the above example, the cluster has 15 nodes, 4 nodes have 2 cores each, 11 nodes have 4 cores each.
-
Find the URL to your MKE and the local path to your extracted client bundle.
-
Run the container locally, updating the
UCP_URL
and the path to your extracted client bundle:docker run -t --rm --name kubernetes-cluster-info \ -e UCP_URL="ucp.example.com" \ -v /path/to/your/client/bundle:/data:ro \ mirantis/kubernetes-cluster-info
-
Results will be returned:
$ docker run -t --rm --name kubernetes-cluster-info \ -e UCP_URL="ucp.example.com" \ -v /path/to/your/client/bundle:/data:ro \ mirantis/kubernetes-cluster-info ======================== Data for all nodes: 2 Core x 4 4 Core x 11 # Nodes - 15 Ttl Core - 52 Min Core - 2 Max Core - 4 Avg Core - 3.46 ======================== Data for manager nodes: 4 Core x 3 # Nodes - 3 Ttl Core - 12 Min Core - 4 Max Core - 4 Avg Core - 4.00 ======================== Data for worker nodes: 2 Core x 4 4 Core x 8 # Nodes - 12 Ttl Core - 40 Min Core - 2 Max Core - 4 Avg Core - 3.33 ========================
In the above example, the cluster has 15 nodes, 4 nodes have 2 cores each, 11 nodes have 4 cores each.
If you wish to retrieve some basic data from a MKE support dump, you can utilize the support_dump_count_cores.sh
script to analyze the dump locally. There is less detailed information in the support dump as the data structure is a bit different than the API calls but you can get general information about cluster size.