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
Go to the GKE Kubernetes Clusters page for your project. The following button takes you there:
Click Create Cluster.
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.
Master version: we recommend version 1.12.7 or higher.
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:
For Legacy Stackdriver support, select the Stackdriver legacy features options:
To remove Stackdriver support, clear all of the checkboxes.
Click Create to create the cluster.
GCLOUD
Use gcloud
to create your cluster:
Open a terminal window with Cloud SDK and
gcloud
installed. One way to do this is to use Cloud Shell:In the Google Cloud Console, 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.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.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:
In the Google Cloud Console, click your cluster's name:
In the Details panel for your cluster, see the status for Legacy Stackdriver Monitoring, Legacy Stackdriver Logging, and Stackdriver Kubernetes Engine Monitoring.
Changing your Stackdriver support
To change the Stackdriver support for an existing cluster, follow the instructions below:
CONSOLE
- Go to the GKE Kubernetes Clusters page for your project:
Upgrade your cluster to version 1.12.7 or higher. For instructions, see Upgrading clusters. Allow the upgrade to complete.
Click Edit edit for your cluster:
Select the Stackdriver support you want in your cluster.
To change to Stackdriver Kubernetes Engine Monitoring support, do the following:
In the Stackdriver Kubernetes Engine Monitoring drop down, select Enabled.
In the Legacy Stackdriver Logging and Legacy Stackdriver Monitoring drop downs, select Disabled.
To change to Legacy Stackdriver support, do the following:
In the Legacy Stackdriver Logging and Legacy Stackdriver Monitoring drop downs, select Disabled.
In the Stackdriver Kubernetes Engine Monitoring drop down, select Enabled.
To remove Stackdriver support, select Disabled in each of these dropdowns.
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."
-
In the Google Cloud Console, 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. 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]
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.
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.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
If you are using Legacy Stackdriver, you should begin to become familiar with the changes in Stackdriver Kubernetes Engine Monitoring by reading Migrating to Stackdriver Kubernetes Engine Monitoring.
You can deploy your application software to your cluster as usual. For more information, see Overview of deploying workloads.
To use Prometheus with this release of Stackdriver Kubernetes Engine Monitoring, see Using Prometheus.