Skip to content

Instantly share code, notes, and snippets.

@welshstew
Last active September 1, 2020 21:14
Show Gist options
  • Select an option

  • Save welshstew/7e2e7890b85b9d6db8b30f32ee055a74 to your computer and use it in GitHub Desktop.

Select an option

Save welshstew/7e2e7890b85b9d6db8b30f32ee055a74 to your computer and use it in GitHub Desktop.
simple helm chart deployment of a prometheus server
---
# Source: prometheus/templates/server-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
labels:
component: "my-prometheus"
app: prometheus
release: my-prometheus
chart: prometheus-11.4.0
heritage: Helm
name: my-prometheus-my-prometheus
data:
alerting_rules.yml: |
{}
alerts: |
{}
prometheus.yml: |
global:
evaluation_interval: 1m
scrape_interval: 1m
scrape_timeout: 10s
rule_files:
- /etc/config/recording_rules.yml
- /etc/config/alerting_rules.yml
- /etc/config/rules
- /etc/config/alerts
scrape_configs:
- job_name: kubernetes-pods
kubernetes_sd_configs:
- role: pod
namespaces:
names:
- monitoringinpaas
relabel_configs:
- action: keep
regex: true
source_labels:
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
- action: replace
regex: (.+)
source_labels:
- __meta_kubernetes_pod_annotation_prometheus_io_path
target_label: __metrics_path__
- action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
source_labels:
- __address__
- __meta_kubernetes_pod_annotation_prometheus_io_port
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
- action: replace
source_labels:
- __meta_kubernetes_namespace
target_label: kubernetes_namespace
- action: replace
source_labels:
- __meta_kubernetes_pod_name
target_label: kubernetes_pod_name
recording_rules.yml: |
{}
rules: |
{}
---
# Source: prometheus/templates/server-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
component: "my-prometheus"
app: prometheus
release: my-prometheus
chart: prometheus-11.4.0
heritage: Helm
name: my-prometheus-my-prometheus
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "1Gi"
---
# Source: prometheus/templates/server-service.yaml
apiVersion: v1
kind: Service
metadata:
labels:
component: "my-prometheus"
app: prometheus
release: my-prometheus
chart: prometheus-11.4.0
heritage: Helm
name: my-prometheus-my-prometheus
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 9090
selector:
component: "my-prometheus"
app: prometheus
release: my-prometheus
sessionAffinity: None
type: "ClusterIP"
---
# Source: prometheus/templates/server-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
component: "my-prometheus"
app: prometheus
release: my-prometheus
chart: prometheus-11.4.0
heritage: Helm
name: my-prometheus-my-prometheus
spec:
selector:
matchLabels:
component: "my-prometheus"
app: prometheus
release: my-prometheus
replicas: 1
template:
metadata:
labels:
component: "my-prometheus"
app: prometheus
release: my-prometheus
chart: prometheus-11.4.0
heritage: Helm
spec:
serviceAccountName: default
containers:
- name: prometheus-my-prometheus-configmap-reload
image: "jimmidyson/configmap-reload:v0.3.0"
imagePullPolicy: "IfNotPresent"
args:
- --volume-dir=/etc/config
- --webhook-url=http://127.0.0.1:9090/-/reload
resources:
{}
volumeMounts:
- name: config-volume
mountPath: /etc/config
readOnly: true
- name: prometheus-my-prometheus
image: "prom/prometheus:v2.18.1"
imagePullPolicy: "IfNotPresent"
args:
- --storage.tsdb.retention.time=15d
- --config.file=/etc/config/prometheus.yml
- --storage.tsdb.path=/data
- --web.console.libraries=/etc/prometheus/console_libraries
- --web.console.templates=/etc/prometheus/consoles
- --web.enable-lifecycle
ports:
- containerPort: 9090
readinessProbe:
httpGet:
path: /-/ready
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
failureThreshold: 3
successThreshold: 1
livenessProbe:
httpGet:
path: /-/healthy
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
failureThreshold: 3
successThreshold: 1
resources:
{}
volumeMounts:
- name: config-volume
mountPath: /etc/config
- name: storage-volume
mountPath: /data
subPath: ""
securityContext: {}
terminationGracePeriodSeconds: 300
volumes:
- name: config-volume
configMap:
name: my-prometheus-my-prometheus
- name: storage-volume
persistentVolumeClaim:
claimName: my-prometheus-my-prometheus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment