Installing Prometheus Operator with Yandex Monitoring support
Prometheus Operator with Yandex Monitoring support makes it easy to install and manage the Yandex Managed Service for Prometheus® monitoring system. You can use it to collect, store, and read metrics from your containers, applications, and infrastructure. The system uses the Prometheus data model and the PromQL
Getting started
-
Make sure that the security groups for the Managed Service for Kubernetes cluster and its node groups are configured correctly. If any rule is missing, add it.
Warning
The configuration of security groups determines the performance and availability of the cluster and the services and applications running in it.
-
Create a service account with the monitoring.editor role.
-
Create an API key for the service account:
-
If you want to install Prometheus Operator using Yandex Cloud Marketplace, create an API key in JSON format and save it to the
sa-key.json
file:yc iam api-key create \ --service-account-name=<service_account_name> \ --format=json > sa-key.json
-
If you want to install Prometheus Operator using a Helm chart, run the following command and save the
secret
key you get:yc iam api-key create --service-account-name=<service_account_name>
-
-
Install kubectl
and configure it to work with the created cluster.
Installation using Yandex Cloud Marketplace
- Go to the folder page
and select Managed Service for Kubernetes. - Click the name of the Kubernetes cluster you need and select the Marketplace tab.
- Under Application available for installation, select Prometheus Operator with Yandex Monitoring support and click Go to install.
- Configure the application:
- Namespace: Select a namespace or create a new one.
- Application name: Specify the app name.
- Prometheus Workspace: Select the required Prometheus workspace.
- API key: Specify the contents of the
sa-key.json
file you got earlier.
- Click Install.
- Wait for the application to change its status to
Deployed
.
Installation using a Helm chart
-
Install Helm
v3.8.0 or higher. -
Get the Prometheus workspace ID, you will need it for further setup:
- On the Yandex Monitoring home page
, select Prometheus in the left-hand panel. - Go to the page of the required workspace. The page displays its ID.
- On the Yandex Monitoring home page
-
To install a Helm chart
with Prometheus Operator, run the following command:helm pull oci://cr.yandex/yc-marketplace/yandex-cloud/prometheus/kube-prometheus-stack \ --version 57.2.0-1 \ --untar && \ helm install \ --namespace <namespace_for_Prometheus_Operator> \ --create-namespace \ --set prometheusWorkspaceId=<Prometheus_workspace_ID> \ --set iam_api_key_value_generated.secretAccessKey=<secret_part_of_API_key> \ prometheus ./kube-prometheus-stack/
The command will also create a new namespace required for Prometheus Operator.
Note
If you are using a Helm version below 3.8.0, append the
export HELM_EXPERIMENTAL_OCI=1 && \
string to the command to enable Open Container Initiative (OCI) support in the Helm client. -
Make sure the Prometheus Operator pods have changed their status to
Running
:kubectl get pods --namespace=<namespace_for_Prometheus_Operator> \ -l "release=prometheus"
Connecting to a Grafana dashboard
To connect to a Grafana dashboard:
-
Get the name of the pod with the running Grafana application:
kubectl get pods --namespace=<namespace_for_Prometheus_Operator> \ | grep grafana
-
Configure
grafana
port forwarding to the local computer:kubectl port-forward --namespace=<namespace_for_Prometheus_Operator> \ <Grafana_pod_name> 8080:3000
Note
If you close the terminal window or abort the command, port forwarding will be stopped.
-
In your browser, open the Grafana dashboard at
http://localhost:8080
. -
Sign in using the
admin
username andprom-operator
password.
See also
© 2024 Linux Foundation. All rights reserved. The Linux Foundation owns and uses registered trademarks. For a list of Linux Foundation trademarks, see Trademark Usage