01 Run projects list command (Windows/macOS/Linux) with custom output filters to list the ID of each GCP project available in your Google Cloud account:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
gcloud projects list
--format="table(projectId)"
02 The command output should return the requested GCP project IDS:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
PROJECT_ID
cc-web-project-123123
cc-dev-project-112233
03 Run container clusters list command (Windows/macOS/Linux) with the ID of the GCP project that you want to examine as the identifier parameter and custom output filters to describe the name and the region of each GKE cluster provisioned for the selected project:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
gcloud container clusters list
--project cc-web-project-123123
--format="table(NAME,ZONE)"
04 The command output should return the requested cluster names and their regions:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
NAME: cc-gke-backend-cluster
ZONE: us-central1
NAME: cc-gke-frontend-cluster
ZONE: us-central1
05 Run container clusters describe command (Windows/macOS/Linux) with the name of the GKE cluster that you want to examine as the identifier parameter and custom output filters to determine if cost allocation is enabled for the selected GKE cluster:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
gcloud container clusters describe cc-gke-backend-cluster
--region=us-central1
--format="json(costManagementConfig.enabled)"
06 The command output should return the feature configuration and status:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
null
If the
container clusters describe command output returns
null, as shown in the example above, the Cost Allocation feature is not enabled for the selected Google Kubernetes Engine (GKE) cluster.
07 Repeat steps no. 5 and 6 for each GKE cluster provisioned for the selected GCP project.
08 Repeat steps no. 3 – 7 for each GCP project deployed in your Google Cloud account.