Installing Postgres and Postgres exporter helm charts
Описание
This is an example showing how an exporter can be installed into your K8s cluster and annotated so that Prometheus scrapes the metrics provided by the cluster.
Here are the commands used in the demo:
```
helm version
# Alternative: https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/master/doc/howto/auto_devops/useful_commands.m #talking-to-tiller
helm init
# Required for RBAC clusters
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
helm repo add bitnami https://charts.bitnami.com/bitnami
# helm install --name postgresql stable/postgresql
helm install --name postgresql bitnami/postgresql
helm install --name prometheus-postgres-exporter --set-string service.annotations."prometheus\.io/scrape"=true --set-string service.annotations."prometheus\.io/port"=9187 --set config.datasource.host=postgresql.default.svc.cluster.local --set config.datasource.passwordSecret.name=postgresql --set config.datasource.passwordSecret.key=postgresql-password --set config.datasource.password= --devel stable/prometheus-postgres-exporter
# Run helm list and make sure "App Version" of prometheus-postgres-exporter is greater than 0.6.2.
# Run helm repo update if the version is less than 0.6.2 and run the the helm install command
# again. 0.6.2 is the version at which the postgres-exporter chart started supporting
# reading the Postgres DB password from a secret.
helm list
# To check logs of postgres-exporter
kubectl logs $(kubectl get pods -A | grep 'prometheus-postgres-exporter-' | awk '{print $2}')
# Access Prometheus UI
kubectl port-forward $(kubectl get pods -A | grep 'prometheus-prometheus-server-' | awk '{print $2}') 9090:9090 -n gitlab-managed-apps
Try metric: pg_stat_database_xact_commit
```
Рекомендуемые видео



















