Worker Cluster Setup
In order to setup the prometheus on worker cluster ,user need to install this script .Script will be automatically setup all the thing on the "monitoring" Namespace.
Requirement
1.Helm need be install on the system
2.Need cortex endpoint
with Username & Password
of the Tenant , managed by the users
Script
#!/bin/bash
#create Namespace
kubectl create namespace monitoring
# Adding Helm repository for Prometheus
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
# Installing Prometheus server using Helm
helm install prometheus-server prometheus-community/prometheus -n monitoring
# Asking user for the Cortex-nginx IP or Domain and Basic Auth credentials
echo "Enter Cortex-nginx IP or Domain (e.g., http://8005.server.xyz.np , http://192.168.12.12):"
read cortexNginx
echo "Enter Basic Auth username and password (format: username password):"
read UserName PasswordHttpAuth
# Creating the Prometheus custom values file
cat << EOF > prometheus_values.yaml
rbac:
create: true
podSecurityPolicy:
enabled: false
configmapReload:
prometheus:
enabled: true
server:
remoteWrite:
- url: $cortexNginx/api/prom/push
basic_auth:
username: $UserName
password: $PasswordHttpAuth
EOF
# Upgrading Prometheus using the custom values file
helm upgrade -f prometheus_values.yaml prometheus-server prometheus-community/prometheus -n monitoring