跳到主要内容
版本:v2.0-v2.4

Project Monitoring

Available as of v2.2.4

Using Rancher, you can monitor the state and processes of your cluster nodes, Kubernetes components, and software deployments through integration with Prometheus, a leading open-source monitoring solution.

Monitoring Scope

Using Prometheus, you can monitor Rancher at both the cluster level and project level. For each cluster and project that is enabled for monitoring, Rancher deploys a Prometheus server.

  • Cluster monitoring allows you to view the health of your Kubernetes cluster. Prometheus collects metrics from the cluster components below, which you can view in graphs and charts.

    • Kubernetes control plane
    • etcd database
    • All nodes (including workers)
  • Project monitoring allows you to view the state of pods running in a given project. Prometheus collects metrics from the project's deployed HTTP and TCP/UDP workloads.

Permissions to Configure Project Monitoring

Only administrators, cluster owners or members, or project owners can configure project level monitoring. Project members can only view monitoring metrics.

Enabling Project Monitoring

Prerequisite: Cluster monitoring must be enabled.

  1. Go to the project where monitoring should be enabled. Note: When cluster monitoring is enabled, monitoring is also enabled by default in the System project.

  2. Select Tools > Monitoring in the navigation bar.

  3. Select Enable to show the Prometheus configuration options. Enter in your desired configuration options.

  4. Click Save.

Project-Level Monitoring Resource Requirements

ContainerCPU - RequestMem - RequestCPU - LimitMem - LimitConfigurable
Prometheus750m750Mi1000m1000MiYes
Grafana100m100Mi200m200MiNo

Result: A single application,project-monitoring, is added as an application to the project. After the application is active, you can start viewing project metrics through the Rancher dashboard or directly from Grafana.

The default username and password for the Grafana instance will be admin/admin. However, Grafana dashboards are served via the Rancher authentication proxy, so only users who are currently authenticated into the Rancher server have access to the Grafana dashboard.

Project Metrics

Workload metrics are available for the project if monitoring is enabled at the cluster level and at the project level.

You can monitor custom metrics from any exporters. You can also expose some custom endpoints on deployments without needing to configure Prometheus for your project.

Example: A Redis application is deployed in the namespace redis-app in the project Datacenter. It is monitored via Redis exporter. After enabling project monitoring, you can edit the application to configure the Advanced Options -> Custom Metrics section. Enter the Container Port and Path and select the Protocol.

To access a project-level Grafana instance,

  1. From the Global view, navigate to a cluster that has monitoring enabled.

  2. Go to a project that has monitoring enabled.

  3. From the project view, click Apps. In versions before v2.2.0, choose Catalog Apps on the main navigation bar.

  4. Go to the project-monitoring application.

  5. In the project-monitoring application, there are two /index.html links: one that leads to a Grafana instance and one that leads to a Prometheus instance. When you click the Grafana link, it will redirect you to a new webpage for Grafana, which shows metrics for the cluster.

  6. You will be signed in to the Grafana instance automatically. The default username is admin and the default password is admin. For security, we recommend that you log out of Grafana, log back in with the admin password, and change your password.

Results: You will be logged into Grafana from the Grafana instance. After logging in, you can view the preset Grafana dashboards, which are imported via the Grafana provisioning mechanism, so you cannot modify them directly. For now, if you want to configure your own dashboards, clone the original and modify the new copy.