Skip to content

Commit

Permalink
Merge pull request #215 from OT-CONTAINER-KIT/helm-pga-setup
Browse files Browse the repository at this point in the history
PGA helm chart
  • Loading branch information
ashwani-opstree authored Jul 31, 2024
2 parents d5edc1d + a17d450 commit fb86adf
Show file tree
Hide file tree
Showing 11 changed files with 771 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.tgz
*.tgz
Chart.lock
56 changes: 56 additions & 0 deletions charts/pga/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v2
name: pga
description: A Helm chart for prometheus, grafana and alertmanager
type: application
version: 1.0.0
appVersion: 1.0.0
maintainers:
- name: ashwani-opstree

dependencies:
- name: kube-prometheus-stack
version: 61.3.1
repository: https://prometheus-community.github.io/helm-charts/
alias: app
tags:
- monitoring
condition: app.enabled

- name: kube-prometheus-stack
version: 61.3.1
repository: https://prometheus-community.github.io/helm-charts/
alias: kube
tags:
- monitoring

- name: prometheus-adapter
version: 4.10.0
repository: https://prometheus-community.github.io/helm-charts/
tags:
- monitoring
alias: adapter
condition: adapter.enabled

- name: prometheus-pushgateway
version: 2.14.0
repository: https://prometheus-community.github.io/helm-charts/
tags:
- monitoring
alias: pushgateway
condition: pushgateway.enabled

- name: prometheus-blackbox-exporter
version: 8.17.0
repository: https://prometheus-community.github.io/helm-charts/
tags:
- blackbox
alias: blackbox
condition: blackbox.enabled

- name: thanos
version: 15.7.12
repository: https://charts.bitnami.com/bitnami
tags:
- thanos
alias: thanos
condition: thanos.enabled
36 changes: 36 additions & 0 deletions charts/pga/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Prometheus Monitoring Setup with Helm

This document provides detailed instructions for setting up Prometheus monitoring in a Kubernetes cluster using Helm charts. Follow these commands to deploy Prometheus and its associated components.

## 1. Apply Custom Resource Definitions (CRDs)

Run the following commands to apply each CRD:

```bash
kubectl apply --server-side=true -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-61.5.0/charts/kube-prometheus-stack/charts/crds/crds/crd-alertmanagers.yaml
kubectl apply --server-side=true -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-61.5.0/charts/kube-prometheus-stack/charts/crds/crds/crd-alertmanagerconfigs.yaml
kubectl apply --server-side=true -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-61.5.0/charts/kube-prometheus-stack/charts/crds/crds/crd-podmonitors.yaml
kubectl apply --server-side=true -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-61.5.0/charts/kube-prometheus-stack/charts/crds/crds/crd-probes.yaml
kubectl apply --server-side=true -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-61.5.0/charts/kube-prometheus-stack/charts/crds/crds/crd-prometheusagents.yaml
kubectl apply --server-side=true -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-61.5.0/charts/kube-prometheus-stack/charts/crds/crds/crd-prometheuses.yaml
kubectl apply --server-side=true -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-61.5.0/charts/kube-prometheus-stack/charts/crds/crds/crd-prometheusrules.yaml
kubectl apply --server-side=true -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-61.5.0/charts/kube-prometheus-stack/charts/crds/crds/crd-scrapeconfigs.yaml
kubectl apply --server-side=true -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-61.5.0/charts/kube-prometheus-stack/charts/crds/crds/crd-servicemonitors.yaml
kubectl apply --server-side=true -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-61.5.0/charts/kube-prometheus-stack/charts/crds/crds/crd-thanosrulers.yaml
```
## 2. Update Helm Chart Dependencies
```bash
helm dep update
```
Updates Helm chart dependencies.

## 3. Create a Namespace for Monitoring
```bash
kubectl create ns monitoring
```
Creates a Kubernetes namespace named monitoring.

## 4. Render chart templates locally and apply
```bash
helm template --name-template=monitoring . -n monitoring -f values.yaml | kubectl apply -f -
```
19 changes: 19 additions & 0 deletions charts/pga/examples/thanos/pga.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
app:
enabled: false

kube:
enabled: true
grafana:
enabled: true
sidecar:
datasources:
defaultDatasourceEnabled: false

pushgateway:
enabled: false

blackbox:
enabled: false

adapter:
enabled: true
257 changes: 257 additions & 0 deletions charts/pga/examples/thanos/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
app:
enabled: false

kube:
enabled: true
fullnameOverride: kube
commonLabels:
prometheus: kube
defaultRules:
create: false
alertmanager:
enabled: true
alertmanagerSpec:
retention: 240h
resources:
requests:
cpu: 250m
memory: 500Mi
limits:
cpu: 250m
memory: 500Mi
storage:
volumeClaimTemplate:
spec:
# storageClassName: encrypted-gp3
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
grafana:
enabled: true
sidecar:
datasources:
defaultDatasourceEnabled: false
kubeApiServer:
enabled: true
kubelet:
enabled: true
namespace: kube-system
kubeControllerManager:
enabled: false
coreDns:
enabled: true
kubeEtcd:
enabled: false
kubeScheduler:
enabled: false
kubeProxy:
enabled: false
kubeStateMetrics:
enabled: true
kube-state-metrics:
customLabels:
prometheus: kube
enabled: true
podSecurityPolicy:
enabled: false
resources:
requests:
cpu: 250m
memory: 500Mi
limits:
cpu: 250m
memory: 500Mi
nodeExporter:
enabled: true
prometheus-node-exporter:
prometheus:
monitor:
additionalLabels:
prometheus: kube
# rbac:
# pspEnabled: false
# image:
# repository:
# tag: latest
# pullPolicy: Always
prometheusOperator:
enabled: true
admissionWebhooks:
enabled: false
deployment:
enabled: true
tls:
enabled: false
prometheus:
enabled: true
thanosService:
enabled: true
thanosServiceMonitor:
enabled: true
prometheusSpec:
externalLabels:
kkubernetes_cluster: opstree
prometheus_cluster: kube
# get more details https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.ThanosSpec
thanos:
version: 0.35.1
# image: quay.io/thanos/thanos:v0.35.1
blockSize: 5m
objectStorageConfig:
existingSecret:
key: objstore.yml
name: monitoring-thanos-objstore-secret
# nodeSelector:
# appType: monitoring
# tolerations:
# - key: "appType"
# operator: "Equal"
# value: "monitoring"
# effect: "NoSchedule"
# remoteWrite:
# - url: https://app.last9.io/jupiter/prometheus/write
# basicAuth:
# username:
# name: promsecret
# key: username
# password:
# name: promsecret
# key: password
## # Do not add the writeRelabelConfigs section if you want to
## # send all metrics via remote write
## writeRelabelConfigs:
# - sourceLabels: [ __name__ ]
# regex: 'istio*'
# action: keep
# image:
# tag: v2.41.0
retention: 1h
replicas: 2
# externalUrl: "http://kube-opstree.prod.internal/"
resources:
requests:
cpu: "500m"
memory: 500Mi
limits:
cpu: "500m"
memory: 500Mi
storageSpec:
volumeClaimTemplate:
spec:
# storageClassName: encrypted-gp3
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: 1Gi
serviceMonitorSelector:
matchExpressions:
- key: prometheus
operator: In
values:
- kube
podMonitorSelector:
matchExpressions:
- key: prometheus
operator: In
values:
- kube
ruleSelector:
matchLabels:
prometheus: kube
service:
name: kube-prometheus


pushgateway:
enabled: false
serviceMonitor:
enabled: true
namespace: monitoring
additionalLabels:
prometheus: app
extraArgs:
- --log.level=debug
- --push.disable-consistency-check
resources:
limits:
cpu: 1
memory: 4096Mi
requests:
cpu: 500m
memory: 4096Mi

blackbox:
enabled: false
serviceMonitor:
enabled: true
defaults:
additionalMetricsRelabels: {}
labels:
prometheus: app
interval: 30s
scrapeTimeout: 30s
module: http_2xx
config:
modules:
http_2xx:
prober: http
timeout: 5s
http:
valid_http_versions: [ "HTTP/1.0", "HTTP/1.1", "HTTP/2.0" ]
no_follow_redirects: false
preferred_ip_protocol: "ip4"
fail_if_ssl: false
fail_if_not_ssl: false

adapter:
enabled: false

thanos:
enabled: true
objstoreConfig: |-
type: s3
config:
bucket: thanos
endpoint: monitoring-minio.monitoring.svc.cluster.local:9000
access_key: minio
secret_key: minio123
insecure: true
query:
dnsDiscovery:
sidecarsService: kube-thanos-discovery
sidecarsNamespace: monitoring
bucketweb:
enabled: true
compactor:
enabled: false
storegateway:
enabled: true
ruler:
enabled: true
serviceMonitor:
namespace: monitoring
alertmanagers:
- http://kube-alertmanager.monitoring.svc.cluster.local:9093
config: |-
groups:
- name: "metamonitoring"
rules:
- alert: "PrometheusDown"
expr: absent(up{prometheus="monitoring/kube-prometheus"})
metrics:
enabled: true
serviceMonitor:
namespace: monitoring
enabled: true
minio:
enabled: true
auth:
rootPassword: minio123
rootUser: minio
monitoringBuckets: thanos
accessKey:
password: minio
secretKey:
password: minio123
Loading

0 comments on commit fb86adf

Please sign in to comment.