Skip to content

Configure tenant with MINIO_PROMETHEUS_URL and MINIO_PROMETHEUS_JOB_ID

Allan Roger Reid edited this page Jul 16, 2024 · 1 revision

Using mc, generate the necessary scrape configuration. Create a prometheus.yml using this output. e.g.

mc admin prometheus generate acme cluster
cat << EOF > prometheus.yml
global:
  scrape_interval: 15s
scrape_configs:
- job_name: minio-job
  bearer_token: <bearer_token>
  metrics_path: /minio/v2/metrics/cluster
  scheme: http
  static_configs:
  - targets: ['<host>:<port>']
EOF

Create a ConfigMap to store this information under Workloads > ConfigMaps. e.g.

kind: ConfigMap
apiVersion: v1
metadata:
  name: prometheus
  namespace: prometheus
immutable: false
data:
  prometheus.yml: |
    global:
      scrape_interval: 15s
    scrape_configs:
    - job_name: minio-job
      bearer_token: <bearer_token>
      scheme: http
      static_configs:
      - targets: ['<host>:<port>']

Edit the prometheus statefulset yaml. Under spec.template.spec.volumes, create a new volume pointing to the ConfigMap and add its corresponding volume mount under spec.template.spec.containers.volumeMounts e.g.

spec:
  ...
  template:
    ...
    spec:
      containers:
        - ...
          volumeMounts:
            - mountPath: /etc/prometheus/
              name: volume-prometheus-config
      ...
      volumes:
        - configMap:
            defaultMode: 420
            name: prometheus
          name: volume-prometheus-config
...

Validate that the prometheus pod restarts. In the pod terminal validate that the path /etc/prometheus/prometheus.yml exists.

Add the env variables to the minio tenant and restart. Once the pods are up validate that the minio console metrics are visible.

Make a backup of secret storage-configuration

k -n tenant-lite get secrets storage-configuration -o yaml > storage-configuration-backup.yaml

Get current values in secret storage-configuration

k -n tenant-lite get secrets storage-configuration -o json | jq .data.\"config.env\" | tr -d '"' | base64 -d
export MINIO_ROOT_USER="minio"
export MINIO_ROOT_PASSWORD="minio123"
export MINIO_STORAGE_CLASS_STANDARD="EC:2"
export MINIO_BROWSER="on"% 

Create a new base64-encoded secret with MINIO_PROMETHEUS_URL and MINIO_PROMETHEUS_JOB_ID

echo 'export MINIO_ROOT_USER="minio"
export MINIO_ROOT_PASSWORD="minio123"
export MINIO_STORAGE_CLASS_STANDARD="EC:2"
export MINIO_BROWSER="on"
export MINIO_PROMETHEUS_URL=http://<your prometheus domain>
export MINIO_PROMETHEUS_JOB_ID=minio-job' | base64

Create script for new secret

cat << EOF > storage-configuration.yaml
apiVersion: v1
data:
  config.env: ZXhwb3J0IE1JTklPX1JPT1RfVVNFUj0ibWluaW8iCmV4cG9ydCBNSU5JT19ST09UX1BBU1NXT1JEPSJtaW5pbzEyMyIKZXhwb3J0IE1JTklPX1NUT1JBR0VfQ0xBU1NfU1RBTkRBUkQ9IkVDOjIiCmV4cG9ydCBNSU5JT19CUk9XU0VSPSJvbiIKZXhwb3J0IE1JTklPX1BST01FVEhFVVNfVVJMPWh0dHA6Ly9wcm9tZXRoZXVzLXByb21ldGhldXMuYXBwcy5vcGVuc2hpZnQubWluLmRldgpleHBvcnQgTUlOSU9fUFJPTUVUSEVVU19KT0JfSUQ9bWluaW8tam9iCg==
kind: Secret
metadata:
  name: storage-configuration
  namespace: tenant-lite
type: Opaque
EOF

Apply the new secret

k apply -f storage-configuration.yaml

Get current values in secret storage-configuration

export MINIO_ROOT_USER="minio"
export MINIO_ROOT_PASSWORD="minio123"
export MINIO_STORAGE_CLASS_STANDARD="EC:2"
export MINIO_BROWSER="on"
export MINIO_PROMETHEUS_URL=<your prometheus domain>
export MINIO_PROMETHEUS_JOB_ID=minio-job
Clone this wiki locally