Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

how to create dashborad to monitor gke workload or gke service

how to create dashborad to monitor gke workload or gke serviceac

I want create dashbord like , if any GKE workload running fine should show in green and any service down should show red in dashboard using terraform code

0 3 385
3 REPLIES 3

Good day and welcome to the community!

You may create a dashboard to monitor your GKE workload or service account by using Google Cloud's Workload Identity[1] or Kubernetes service accounts[2]. To create a Kubernetes service account, you can follow the steps below: 

  1. Configure kubectl to communicate with your cluster: 

        gcloud container clusters get-credentials [CLUSTER_NAME] --zone [ZONE] --project [PROJECT_ID] 

  1. Create a Kubernetes service account: 

       kubectl create serviceaccount [SERVICE_ACCOUNT_NAME] 

  1. Bind the Kubernetes service account to an IAM role: 

         kubectl create rolebinding [ROLE_BINDING_NAME] --clusterrole=[CLUSTER_ROLE_NAME] --serviceaccount=[NAMESPACE]:[SERVICE_ACCOUNT_NAME] 

You can then use the Kubernetes service account credentials in applications running on GKE clusters[3].  You may create a Kubernetes dashboard on a GKE cluster using Terraform. Try to deploy a 2-node separately managed node pool GKE cluster using Terraform and configure kubectl using Terraform output to deploy a Kubernetes dashboard on the cluster. 

You can use the google_monitoring_dashboard resource in Terraform to create a dashboard for monitoring your GKE workloads. 

You can use the google_container_cluster resource in Terraform to create a GKE cluster.

Hope this helps.

[1]  Use Workload Identity | Google Kubernetes Engine (GKE) - Google Cloud. https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity.

[2] Use Kubernetes service accounts | Google Kubernetes Engine (GKE .... https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts. 

[3] Authenticate to Google Cloud using a service account. https://cloud.google.com/kubernetes-engine/docs/tutorials/authenticating-to-cloud-platform.

can you provide the filter to monitor workload incase of multiple
workloads, each workload up and running or not?

Lets say I have 10 workloads should run, but if 8 running fine and 2 are
not running,

8 workloads should display in green and 2 should display in red, so that
support can check start investigate on the failed workloads

Hi  Team,

I am  also looking for the same solution that Sridhar is expecting - Is this can be done in Grafana, Looker studio or Kibana - please suggest us the better way to visualize and monitor this for the support team 

Thanks,

Pavan

Top Labels in this Space