Installing Stackdriver support

Google Kubernetes Engine (GKE) now includes managed support for Stackdriver. Installing Stackdriver support lets you monitor your running GKE clusters, manage your system and debug logs, and analyze your system's performance using advanced profiling and tracing capabilities.

This page describes how to:

  • Create a new your cluster and configure Stackdriver Kubernetes Engine Monitoring or Legacy Stackdriver.
  • Select whether to collect application logs or not.
  • Disable all Stackdriver integration for a cluster.

Stackdriver Kubernetes Engine Monitoring provides a single option that enables improved support for both Stackdriver Monitoring and Stackdriver Logging in your clusters. With Legacy Stackdriver, you could enable Monitoring without Logging, but this option is not supported in Stackdriver Kubernetes Engine Monitoring.

Before you begin

  • Determine which Stackdriver support for GKE option you want to use.

  • You must be an Owner of the project containing your cluster. Your project must be associated with a Workspace.

Selecting Stackdriver support for a new cluster

When you create a new GKE cluster, you get Stackdriver Kubernetes Engine Monitoring support by default. Alternatively, you can select Legacy Stackdriver support or remove all Stackdriver support.

The cluster-creation instructions in this section cover only the options relevant to Stackdriver. For complete instructions on creating a GKE cluster, see Creating a cluster.

CONSOLE

  1. Go to the GKE Kubernetes Clusters page for your project. The following button takes you there:

    Go to Kubernetes clusters

  2. Click Create Cluster.

  3. In the dialog, specify the following fields in addition to any other properties you want in your cluster. For more information, see Creating a Cluster.

    1. Master version: we recommend version 1.12.7 or higher.

    2. Scroll down to the Advanced options section under Additional features to select the Stackdriver support you want in your new cluster.

      • For Stackdriver Kubernetes Engine Monitoring support, select Enable Stackdriver Kubernetes Engine Monitoring:

        Select Stackdriver Kubernetes Engine Monitoring support.

      • For Legacy Stackdriver support, select the Stackdriver legacy features options:

        Select Legacy Stackdriver support.

      • To remove Stackdriver support, clear all of the checkboxes.

  4. Click Create to create the cluster.

GCLOUD

Use gcloud to create your cluster:

  1. Open a terminal window with Cloud SDK and gcloud installed. One way to do this is to use Cloud Shell:

    In the Cloud Console, go to Cloud Shell.

    Go to Cloud Shell

    At the bottom of the Cloud Console, a Cloud Shell session opens and displays a command-line prompt. Cloud Shell is a shell environment with the Cloud SDK already installed, including the gcloud command-line tool, and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. To select Stackdriver Kubernetes Engine Monitoring support for your new cluster, include the --enable-stackdriver-kubernetes option in the create command:

    gcloud beta container clusters create [CLUSTER_NAME] \
      --zone=[ZONE] \
      --project=[PROJECT_ID] \
      --cluster-version=[CLUSTER_VERSION] \
      --enable-stackdriver-kubernetes
    

    In the previous expression, [CLUSTER_NAME] is your clusters' name, [ZONE] is the compute zone for the cluster, and [PROJECT_ID] is the Google Cloud project ID, not the project name.

    [CLUSTER_VERSION] is the GKE version to install on the cluster. You can enter the specific patch release to install, for example 1.12.8-gke.10. Otherwise, you can enter the minor version to install, for example, 1.12.8, and your cluster is created with the latest patch version. For more information on GKE versioning, see Versioning and upgrades.

  3. Alternatively, to select Legacy Stackdriver for your new cluster, create your cluster without special options for monitoring or logging. You get Legacy Stackdriver support by default. For example, a simple creation with default options might look like the following:

    gcloud container clusters create [CLUSTER_NAME] \
      --zone=[ZONE] \
      --project=[PROJECT_ID] \
      --cluster-version=[CLUSTER_VERSION]
    

Updating an existing cluster

The following instructions explain how to do the following:

  • Update a cluster from no Stackdriver support to Legacy Stackdriver.
  • Update a cluster from no Stackdriver support to Stackdriver Kubernetes Engine Monitoring.
  • Update a cluster from Legacy Stackdriver to Stackdriver Kubernetes Engine Monitoring. You might also have to change your Stackdriver configurations. See Migrating to Stackdriver Kubernetes Engine Monitoring.
  • Remove Stackdriver support from your cluster.

Which Stackdriver support does my cluster use?

To see which Stackdriver support your cluster is using, complete the following steps:

  1. In the Google Cloud Console, click your cluster's name:

    Go to Kubernetes clusters

  2. In the Details panel for your cluster, see the status for Legacy Stackdriver Monitoring, Legacy Stackdriver Logging, and Stackdriver Kubernetes Engine Monitoring.

    Cluster details screen.

Changing your Stackdriver support

To change the Stackdriver support for an existing cluster, follow the instructions below:

CONSOLE

  1. Go to the GKE Kubernetes Clusters page for your project:

Go to Kubernetes clusters

  1. Upgrade your cluster to version 1.12.7 or higher. For instructions, see Upgrading clusters. Allow the upgrade to complete.

  2. Click Edit for your cluster:

    Edit a GKE cluster.

  3. Select the Stackdriver support you want in your cluster.

    • To change to Stackdriver Kubernetes Engine Monitoring support, do the following:

      1. In the Stackdriver Kubernetes Engine Monitoring drop down, select Enabled.

      2. In the Legacy Stackdriver Logging and Legacy Stackdriver Monitoring drop downs, select Disabled.

        Choose Stackdriver Kubernetes Engine Monitoring support.

    • To change to Legacy Stackdriver support, do the following:

      1. In the Legacy Stackdriver Logging and Legacy Stackdriver Monitoring drop downs, select Disabled.

      2. In the Stackdriver Kubernetes Engine Monitoring drop down, select Enabled.

        Choose Legacy Stackdriver supports.

    • To remove Stackdriver support, select Disabled in each of these dropdowns.

  4. Click Save.

GCLOUD

The following gcloud instructions cover upgrading your cluster's Stackdriver support using the gcloud container clusters update command. Notice that you use the update command, not the upgrade command, even though we sometimes refer to this process as "upgrading."

  1. In the Cloud Console, go to Cloud Shell.

    Go to Cloud Shell

    At the bottom of the Cloud Console, a Cloud Shell session opens and displays a command-line prompt. Cloud Shell is a shell environment with the Cloud SDK already installed, including the gcloud command-line tool, and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. If you have not done so, set up default values for your cluster in Cloud SDK:

    gcloud config set project [PROJECT_ID]
    gcloud config set compute/zone [ZONE]
    
  3. Update your cluster to the desired Kubernetes version and select the Stackdriver support you want in the cluster. All approved GKE versions support both Legacy Stackdriver and Stackdriver Kubernetes Engine Monitoring.

  4. The following update command that enables Stackdriver Kubernetes Engine Monitoring only shows the options needed for Stackdriver:

    gcloud beta container clusters update [CLUSTER_NAME] \
      --zone=[ZONE]  --region=[REGION]  \
      --enable-stackdriver-kubernetes
      

    The field [REGION] is the compute region of the cluster.

  5. Alternatively, the following update command that enables Legacy Stackdriver only shows the options needed for Stackdriver:

    gcloud beta container clusters update [CLUSTER_NAME] \
      --zone=[ZONE]  --region=[REGION]  \
      --logging-service logging.googleapis.com \
      --monitoring-service monitoring.googleapis.com
      

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Stackdriver Monitoring