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-gke.0 or later.

Creating the cluster

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

CONSOLE

Temporarily, it is not possible to use the console to create a Kubernetes cluster supporting this Beta release. See the gcloud instructions instead.

GCLOUD

Use gcloud to create your cluster with Stackdriver Kubernetes Monitoring:

  1. Open a terminal window with the Cloud SDK and gcloud alpha 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 with the following command.

    CLOUDSDK_CONTAINER_USE_V1_API=false \
    CLOUDSDK_API_CLIENT_OVERRIDES_CONTAINER=v1beta1 \
    gcloud alpha container clusters create [CLUSTER_NAME] \
      --zone=[ZONE_WITH_1.10.2-gke.0] \
      --project=[PROJECT_ID] \
      --cluster-version=1.10.2-gke.0 \
      --enable-stackdriver-kubernetes \
      --enable-kubernetes-alpha
    

    Choosing [ZONE_WITH_1.10.2-gke.0]: You can use us-east1-d immediately; for other zones, see the rollout schedule.

Troubleshooting:

  • If gcloud alpha 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. You should see that all Stackdriver pods are running.

CONSOLE

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

    Go to the Stackdriver Monitoring console

  2. In Stackdriver Monitoring, go to Resources > Kubernetes Engine v2 for your project.

    If you just created the new cluster, it might take a few minutes for Stackdriver Monitoring to recognize it.

  3. Select the Workload tab.

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

    • heapster-...: the Stackdriver Monitoring agent.
    • metadata-... : the Stackdriver Metadata agent.
    • fluentd-gcp-...: the Stackdriver Logging 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):

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

Next steps

  • If you are familiar with the current Stackdriver support, then review the differences in Stackdriver Kubernetes Monitoring. For example, the monitored resource types used with logs, charts, metrics, and alerting policies have changed.

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

  • To learn about how this Beta release integrates into your Kubernetes application, or to customize the configuration of this release, see Customizing Kubernetes Monitoring.

Send feedback about...

Stackdriver Monitoring