Created
January 14, 2022 09:30
-
-
Save spotlesstofu/710997f88c8c24ca839fab3409987198 to your computer and use it in GitHub Desktop.
Run Prometheus on Kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ConfigMap | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: prometheus-app-conf | |
labels: | |
name: prometheus-app-conf | |
data: | |
prometheus.yml: |- | |
scrape_configs: | |
- job_name: 'prometheus' | |
static_configs: | |
- targets: ['localhost:9090'] | |
--- | |
# Deployment | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: prometheus-deployment | |
labels: | |
app: prometheus-app | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: prometheus-app | |
template: | |
# Pod | |
metadata: | |
labels: | |
app: prometheus-app | |
spec: | |
containers: | |
- name: prometheus | |
image: prom/prometheus | |
args: | |
- "--config.file=/etc/prometheus/prometheus.yml" | |
- "--storage.tsdb.path=/prometheus/" | |
ports: | |
- containerPort: 9090 | |
volumeMounts: | |
- name: prometheus-config-volume | |
mountPath: /etc/prometheus/ | |
- name: prometheus-storage-volume | |
mountPath: /prometheus/ | |
volumes: | |
- name: prometheus-config-volume | |
configMap: | |
defaultMode: 420 | |
name: prometheus-app-conf | |
- name: prometheus-storage-volume | |
emptyDir: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment