Deploying Prometheus

Procedure

  1. Obtain the prometheus.yaml file from the 3.0.0 branch of the MindXDL-deploy repository and run the following command to obtain the image:

    docker pull prom/prometheus:v2.10.0

    1. Before obtaining the image, ensure that you can access the Docker Hub website.
    2. The prometheus.yaml file contains the configuration files for obtaining the NPU-Exporter metrics by default. You can modify the configuration as required.
  2. Run the following command to add a tag to the master node:

    kubectl label nodes Host name of the master node masterselector=dls-master-node --overwrite=true

  3. Run the following command to start the Prometheus service:

    kubectl apply -f prometheus.yaml

    If the following information is displayed, Prometheus is started:

    [root@centos check_env]# kubectl apply -f promethues.yaml 
    clusterrole.rbac.authorization.k8s.io/prometheus created
    serviceaccount/prometheus created
    clusterrolebinding.rbac.authorization.k8s.io/prometheus created
    service/prometheus created
    deployment.apps/prometheus created
    configmap/prometheus-config created
  4. Check the pod status. If the pod is in the Running status, the service is normal.
    [root@centos check_env]# kubectl get pods --all-namespaces | grep prometheus
    kube-system      prometheus-58c69548b4-rhxsc                1/1     Running            0          6d14h
  5. Log in to Prometheus.
    1. Open the browser.
    2. Enter http://IP address of the master node:Port number in the browser address box and press Enter.

      Find the nodePort field in the prometheus.yaml file. The value of this field is the port number of the Prometheus service, which is 30003 by default.