Search code examples
google-cloud-platformgoogle-compute-enginegoogle-kubernetes-enginegcloud

How Do I Grab the Number of Virtual Machines Running in a Node Pool using the CLI


Is it possible to find the number of running Compute Engine Virtual Machines (VM) that belong to a single Google Kubernetes Engine (GKE) node pool using the Google Cloud Platform (GCP) SDK (gcloud) instead of the console?


Solution

  • After give some time I found out that there is no command to view no of nodes in node pools of GKE cluster through gcloud. But can be view using below command

    kubectl get nodes -l cloud.google.com/gke-nodepool=$POOL_NAME -o=name  --kubeconfig="$(pwd)/cluster" | wc -l