View Kubernetes logs in Cloud Code for Cloud Shell

This page describes how to view the streaming logs of your application and to check the status of resources from within Cloud Code.

The Development sessions view provides a structured view of the logging output that surfaces tasks, artifacts, and deployed resources. This view lets you see the status of each task in your deployment and locate more information in the full logging output.

The Log Viewer provides tools for searching and filtering logs.

View the status of tasks and resources

When you start a development or debugging session, the Development sessionssection displays the structured logging view.

  • To view the Development sessionssection, open the Command Palette (press Ctrl / Cmd + Shift + P ) and then run the Cloud Code: Focus on development sessions explorercommand.

  • As a task begins, a progress_activity spinning semi-circle progress indicator appears.

  • If a task succeeds, a check_circle checkmark appears next to the step.

  • If a task fails, an error error mark appears next to the step.

  • To see details of a step, click the step in the Development sessionssection. The Outputtab displays the step in the logging output.

  • To view the full Skaffold logs, click the Statusnode.

  • To view the logs for a container, expand Status, expand Stream Application Logs, and then click the container name. The logs for the container are displayed in the Outputtab.

Launch the Log Viewer

To launch the Log Viewer , open the command palette (press Ctrl / Cmd + Shift + P or click View> Command Palette) and then run Cloud Code: View Logs.

Stream logs from a pod

To stream logs from a pod:

  1. Click Cloud Codeand then expand the Kubernetessection.
  2. Expand your minikube cluster and then expand Pods.
  3. Right-click a pod and then click Stream Logs.
  4. If there are multiple containers in the pod, select a container when prompted.

View logs from a pod

  1. Click Cloud Codeand then expand the Kubernetessection.
  2. Expand your minikube cluster and then expand Pods.
  3. Right-click a pod and then click View Logs
  4. If there are multiple containers in the pod, select a container when prompted.

View logs for a specific resource

To view the logs for a specific resource, follow these steps:

  1. Click Cloud Codeand then expand the Kubernetessection.
  2. In the Kubernetessection, expand the following:

    • The cluster whose logs you want to view
    • Namespaces
    • The namespace whose logs you want to view
    • Deployments
  3. Right-click the deployment and select View logs.

View streaming logs

To have the Log Viewer display updated logs as the logs are generated, in the Log Viewer, turn the Streamingslider on.

View Kubernetes logs using Cloud Logging

To display logs from GKE clusters with Cloud Logging enabled, follow these steps:

  1. To open the Log Viewer, open the command palette (press Ctrl / Cmd + Shift + P or click View> Command Palette) and then run Cloud Code: View Logs.
  2. Select Kubernetes Application Logsfrom the Log Typelist.
  3. To stream logs from multiple pods, turn on the Streamingslider and select allin the Podlist.
  4. Logs are displayed for the active cluster by default. To switch to a different cluster, select the cluster name from the Clusterlist.

View Kubernetes logs using kubectl

To display logs from a non-GKE cluster or a GKE cluster without Cloud Logging enabled, follow these steps:

  1. To open the Log Viewer, open the command palette (press Ctrl / Cmd + Shift + P or click View> Command Palette) and then run Cloud Code: View Logs.
  2. Select Kubectl Logsfrom the Log Typelist.
  3. In the Deploymentor Podlist, select a deployment or pod to view logs from.
  4. To refine your search results, click Search Logsand then type search terms. This search includes the namespace, deployment, pod, container, and time. For clusters with Cloud Logging enabled, you can also filter by severity level.

Change the display time

To change the display time to a different time zone, click more_vert Morenext to the Timecolumn header and then choose a time zone.

What's next

Design a Mobile Site
View Site in Mobile | Classic
Share by: