devops/prometheus/prometheus-deployment.yaml

75 lines
1.8 KiB
YAML
Raw Normal View History

2025-09-10 15:34:13 +08:00
apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus
namespace: default
labels:
app: prometheus
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: prometheus
template:
metadata:
labels:
app: prometheus
spec:
serviceAccountName: prometheus
nodeSelector:
node-role.kubernetes.io/control-plane: "true"
containers:
- name: prometheus
image: registry.t-aaron.com/prom/prometheus:latest
ports:
- containerPort: 9090
args:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus/"
- "--web.console.libraries=/etc/prometheus/console_libraries"
- "--web.console.templates=/etc/prometheus/consoles"
- "--storage.tsdb.retention.time=200h"
- "--web.enable-lifecycle"
resources:
requests:
memory: "512Mi"
cpu: "500m"
limits:
memory: "1Gi"
cpu: "1000m"
volumeMounts:
- name: prometheus-config
mountPath: /etc/prometheus/
2025-09-16 10:10:25 +08:00
- name: prometheus-rules
mountPath: /etc/prometheus/rules/
2025-09-10 15:34:13 +08:00
- name: prometheus-storage
mountPath: /prometheus/
volumes:
- name: prometheus-config
configMap:
name: prometheus-config
2025-09-16 10:10:25 +08:00
- name: prometheus-rules
configMap:
name: prometheus-rules
2025-09-10 15:34:13 +08:00
- name: prometheus-storage
hostPath:
path: /opt/prometheus/data
type: DirectoryOrCreate
---
---
apiVersion: v1
kind: Service
metadata:
name: prometheus-service
namespace: default
spec:
selector:
app: prometheus
ports:
- name: http
port: 9090
targetPort: 9090
type: ClusterIP