Skip to main content
Welcome to this step-by-step guide on establishing a secure connection to your Google Kubernetes Engine (GKE) cluster via Google Cloud Shell. You’ll learn how to authenticate your session, verify connectivity with kubectl, and explore workloads directly in the Google Cloud Console.

1. Retrieve Cluster Credentials

  1. Open the GKE Clusters page in the Google Cloud Console.
  2. Click your cluster name.
  3. Select Connect, then choose Run in Cloud Shell.
Cloud Shell will launch at the bottom of your browser with the following command pre-filled:
Press Enter, then Authorize when prompted. This updates your local kubeconfig so that kubectl can interact with your GKE cluster.
You need to run this gcloud container clusters get-credentials command each time you start a new Cloud Shell session, as kubeconfig configurations aren’t persisted across sessions.

2. Verify Connection with kubectl

After retrieving credentials, confirm your connection and inspect system components: Run:
Example output:

3. View Workloads in Google Cloud Console

Inspect workloads and system metrics without leaving the Console:
  1. Close the Cloud Shell terminal window.
  2. In the left-hand navigation, click Workloads.
  3. Toggle Show system workloads.
  4. Filter by kube-system to view system pods.
The image shows a Google Cloud Kubernetes Engine dashboard displaying a list of workloads with their status, type, pods, namespace, and cluster information.
To see per-pod resource metrics:
  • Use the namespace filter to select one or more namespaces.
  • Examine CPU and memory usage, restarts, and error logs in the metrics panel.
The image shows a Google Cloud Kubernetes Engine dashboard displaying metrics for workloads, including CPU and memory usage, container restarts, and error logs.

You’ve successfully connected to your GKE cluster via Cloud Shell, executed essential kubectl commands, and explored workloads in the GCP Console. Next, we’ll guide you through deploying applications to your cluster.

References

Watch Video