Installing Kubernetes Monitoring

The following information explains how to install the opt-in Beta release of Stackdriver Kubernetes Monitoring when you create a new Kubernetes cluster running in Kubernetes Engine.

If you do not follow these instructions, then your new cluster continues to use the current Stackdriver support. That support is described in the Kubernetes Engine guides, Monitoring and Logging.

For information about migrating from the current Stackdriver support to Stackdriver Kubernetes Monitoring, see Migrating to Stackdriver Kubernetes Monitoring.

Before you begin

  • You must be an Owner of the project containing your cluster. For more information, see IAM Role Types.

  • You must use Kubernetes v1.10.2 or later.

Creating the cluster

You can opt into this Beta release when you create a new cluster using the Kubernetes Engine console or the Cloud SDK's gcloud command-line tool.

CONSOLE

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

    GO TO KUBERNETES CLUSTERS

  2. Select Create Cluster at the top of the page.

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

    • Cluster Version: v1.10.2 or later (required)
    • Try the new Beta Monitoring and Logging experience: CHECKED

      If you do not see this option, then you have not selected a cluster version of v1.10.2 or later. If you see the option but it is grayed out, then be sure that both the Stackdriver Logging and Stackdriver Monitoring options are Enabled (the default).

      This part of the option panel should look like the following:

      Beta release opt-in

  4. Click Create to create the cluster. This may take some time.

GCLOUD

Use gcloud to create your cluster with Stackdriver Kubernetes Monitoring:

  1. Open a terminal window with the Cloud SDK and gcloud beta installed.

    One way to do this is to use the Cloud Shell:

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

      GO TO KUBERNETES CLUSTERS

    2. Click the Activate Google Cloud Shell icon at the top of the page.

  2. Create your cluster using Kubernetes v1.10.2 and the --enable-stackdriver-kubernetes option:

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

Troubleshooting:

  • If gcloud beta container does not recognize the flag --enable-stackdriver-kubernetes, then update your gcloud installation:

    gcloud components update
    

Validate your installation

To validate that Stackdriver Monitoring is running properly, wait a few minutes and then examine your cluster. Use either the console or gcloud to see that the Stackdriver pods are running:

CONSOLE

  1. From the GCP console, go to Stackdriver > Monitoring:

    Go to the Stackdriver Monitoring console

  2. In Monitoring, go to Resources > Kubernetes BETA for the Stackdriver account containing your GCP project.

    You can see all the clusters in your Stackdriver account that are using Stackdriver Kubernetes Monitoring.

  3. Select the Workload tab.

  4. Expand your cluster and the kube-system namespace. You should see running pods in the kube-system namespace with the following names:

    • fluentd-gcp-...: the Stackdriver Logging agent.
    • heapster-...: the Monitoring agent.
    • metadata-... : the Stackdriver Metadata agent.

GCLOUD

  1. In GCP Console, with your project selected, open a Cloud Shell window. Alternatively, use your own terminal window with Cloud SDK installed.

  2. Run the following command to connect to your cluster:

    gcloud container clusters get-credentials [CLUSTER_ID] --zone [ZONE] --project [PROJECT_ID]
    
  3. Run the following command to query the Stackdriver Kubernetes Monitoring namespace:

    kubectl get pods --namespace=kube-system
    
  4. You should see pods with the following names (among others):

    • fluentd-gcp-...: the Stackdriver Logging agent.
    • heapster-...: the Monitoring agent.
    • metadata-agent-... : the Stackdriver Metadata agent.

Next steps

  • You can deploy your application software to your cluster as usual. For more information, see Overview of Deploying Workloads.

  • If you are familiar with the current Stackdriver support, then review the differences in Stackdriver Kubernetes Monitoring. For example, this release uses different monitored resource types for your Stackdriver logs, charts, metrics, and alerting policies.

  • To use Prometheus with this Beta release of Stackdriver Kubernetes Monitoring, see Using Prometheus.

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

Send feedback about...

Stackdriver Monitoring