Prometheus is an open source monitoring tool for cloud native applications. This topic describes how to deploy the Prometheus monitoring system by using Alibaba Cloud Container Service for Kubernetes.
- You have created a Kubernetes cluster. For more information, see Create a Kubernetes cluster.
- You have connected to the Master node so that you can view node labels and other information. For more information, see Connect to Kubernetes clusters through kubectl.
- Make sure that the mirror version of the tiller server in the kubernetes cluster is
- Resource, namely, the resource usage of a node or application. The monitoring system of Container Service for Kubernetes monitors node resource usage, cluster resource usage, and pod resource usage.
- Application, namely, internal metrics of an application. For example, The monitoring system collects statistics regarding the number of online users that use an application in real time, and performs service-level monitoring and alarming for the application by exposing ports.
- System components, which are built-in components of the Kubernetes cluster, such as apiserver, controller-manager, and etcd.
- Static resource entities, which include node resource status and kernel events.
- Dynamic resource entities, which are abstract workload entities of Kubernetes, such as deployment, DaemonSet, and pods.
- Customized application objects, which includes the data and metrics that require customization within an application.
To monitor system components and static resource entities, you need to specify monitoring methods for them in the configuration file.
To monitor dynamic resource entities, we recommend that you deploy the Prometheus monitoring system.
- Deploy Prometheus monitoring system
- Log on to the Container Service console.
- In the left-side navigation pane under Container Service-Kubernetes, choose . Then, click ack-prometheus-operator.
- In the Deploy area, select the target cluster. Then, click Create.
Verify the result
- Run the following command to map the Prometheus that is deployed to the cluster to
the local port 9090.
kubectl port-forward svc/ack-prometheus-operator-prometheus 9090:9090 -n monitoring
- To view Prometheus, access
localhost:9090in a browser.Note By default, Prometheus cannot be accessed through the Internet. You must use your local proxy to access it.
- Select Targets under the Status menu to view all collection tasks.If the status of all tasks is UP, all collection tasks are running properly.
- Run the following command to map the Prometheus that is deployed to the cluster to the local port 9090.
- View and display data aggregation.
- Run the following command to may the Grafana that is deployed to the cluster to the
local port 3000.
kubectl -n monitoring port-forward svc/ack-prometheus-operator-grafana 3000:80
localhost:3000in your browser and then select a dashboard to view data aggregation.Note The default user name and password are both admin.
- Run the following command to may the Grafana that is deployed to the cluster to the local port 3000.
- View alerting rules and set alert silencing.
- View alerting rules
localhost:9090in your browser and click the Alerts menu to view the current alerting rules.
- Red: indicates that an alert is triggered.
- Green: indicates the normal status.
- Set alert silencing
Run the following command, open
localhost:9093in your browser, and select Silenced to set alert silencing:
kubectl --namespace monitoring port-forward svc/alertmanager-operated 9093
- View alerting rules