Manual Installation of Kubernetes Monitoring

The following sections explain how to manually install Stackdriver Kubernetes Monitoring in an existing cluster.

Following the manual installation instructions is some information about how Stackdriver Kubernetes Monitoring is implemented.

Installation instructions

These are instructions for manually installing Stackdriver Kubernetes Monitoring in a new cluster.

Summary

  • Use gcloud beta container to create your cluster. Do not install Stackdriver support. Use Kubernetes 1.10.6 or 1.11.2 (or later, if available).

  • Use kubectl to configure Stackdriver Kubernetes Monitoring as shown below.

Create a cluster

  1. Open a terminal window with the Cloud SDK and kubectl installed. An easy 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 Cloud Shell icon at the top of the page.

  2. Create your Kubernetes Engine cluster using the following gcloud command. Do not install any logging or monitoring support:

    gcloud beta container clusters create [CLUSTER_NAME] \
      --zone=[ZONE] \
      --project=[PROJECT_ID] \
      --cluster-version=1.10 \
      --no-enable-cloud-logging \
      --no-enable-cloud-monitoring
    

    For information on other flags and options you might want to use for your cluster, see Creating a Cluster.

Installing Kubernetes Monitoring

  1. Connect to your cluster using the following command:

    gcloud container clusters get-credentials [CLUSTER_ID] --zone [ZONE] --project [PROJECT_ID]
    
  2. Configure Stackdriver Kubernetes Monitoring using the following commands:

    kubectl apply -f https://storage.googleapis.com/stackdriver-kubernetes/stable/rbac-setup.yaml \
      --as=admin --as-group=system:masters
    
    kubectl apply -f https://storage.googleapis.com/stackdriver-kubernetes/stable/agents.yaml
    

For more information about the configuration scripts above, see Configuration files on this page.

Validating your installation

To ensure that Stackdriver Kubernetes Monitoring is running correctly, wait a few minutes and then examine your cluster with the following command:

kubectl get pods --all-namespaces

You should see pods with the following names (among others):

  • stackdriver-logging-agent-...: the Stackdriver Logging agent.
  • heapster-...: the Monitoring agent.
  • stackdriver-metadata-agent-... : the Stackdriver Metadata agent.

Removing manual installations

To uninstall a manual installation, run following command on your cluster:

kubectl delete namespace stackdriver-agents

This step is necessary before you go back to using the recommended managed support for Stackdriver Kubernetes Monitoring. For more information, see Upgrading an existing cluster.

Next steps

  • To use Stackdriver Kubernetes Monitoring, see Observing Your System.

  • 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.

Implementation notes

The information in this section is optional.

Stackdriver Kubernetes Monitoring is implemented by three Stackdriver agents:

  • The Stackdriver Metadata Agent (stackdriver-metadata-agent-...) records the current set of nodes, containers, pods, etc.
  • The Stackdriver Logging Agent (stackdriver-logging-agent-...) sends log entries to Stackdriver Logging.
  • The Stackdriver Monitoring Agent (heapster...) sends metric data to Stackdriver Monitoring. This includes metrics from Prometheus.

The agents run in the one of two namespaces:

  • stackdriver-agents, when installed manually using the scripts on this page
  • kube-system, when installed by Kubernetes Engine console or when installed with gcloud using the --enable-stackdriver-kubernetesoption.

The following diagram shows how these agents are organized.

Kubernetes Monitoring Architecture

Configuration files

The configuration files used to install Stackdriver Kubernetes Monitoring are described below:

Monitored resource types

Stackdriver labels each log entry and metric datum with a monitored resource that identifies the origin of the information. The resource types associated with Stackdriver Kubernetes Monitoring, for both monitoring and logging, are listed below:

These types are not the same as those used by the former Stackdriver support. For a discussion of this incompatibility and how to migrate your existing cluster, see Migrating to Stackdriver Kubernetes Monitoring.

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

Send feedback about...

Stackdriver Monitoring