密钥写死,处理报错
This commit is contained in:
113
k8s/monitoring.yaml
Normal file
113
k8s/monitoring.yaml
Normal file
@@ -0,0 +1,113 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: flask-monitor
|
||||
labels:
|
||||
app: flask-monitor
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: flask-monitor
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: flask-monitor
|
||||
spec:
|
||||
containers:
|
||||
- name: monitor
|
||||
image: flask-prompt-master-monitor:latest
|
||||
env:
|
||||
- name: APP_URL
|
||||
value: "http://flask-prompt-master-service:80"
|
||||
- name: MONITOR_INTERVAL
|
||||
value: "30"
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "200m"
|
||||
volumeMounts:
|
||||
- name: logs
|
||||
mountPath: /app/logs
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- python
|
||||
- -c
|
||||
- "import requests; requests.get('$APP_URL/health')"
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 60
|
||||
volumes:
|
||||
- name: logs
|
||||
persistentVolumeClaim:
|
||||
claimName: logs-pvc
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: flask-log-manager
|
||||
labels:
|
||||
app: flask-log-manager
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: flask-log-manager
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: flask-log-manager
|
||||
spec:
|
||||
containers:
|
||||
- name: log-manager
|
||||
image: flask-prompt-master-log-manager:latest
|
||||
resources:
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
||||
volumeMounts:
|
||||
- name: logs
|
||||
mountPath: /app/logs
|
||||
volumes:
|
||||
- name: logs
|
||||
persistentVolumeClaim:
|
||||
claimName: logs-pvc
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: log-maintenance
|
||||
spec:
|
||||
schedule: "0 2 * * *" # 每天凌晨2点执行
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: log-maintenance
|
||||
image: flask-prompt-master-log-manager:latest
|
||||
command: ["python", "log_manager.py"]
|
||||
volumeMounts:
|
||||
- name: logs
|
||||
mountPath: /app/logs
|
||||
volumes:
|
||||
- name: logs
|
||||
persistentVolumeClaim:
|
||||
claimName: logs-pvc
|
||||
restartPolicy: OnFailure
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: monitor-config
|
||||
data:
|
||||
monitor-interval: "30"
|
||||
alert-threshold: "2.0"
|
||||
retention-days: "30"
|
||||
max-file-size: "10485760" # 10MB
|
||||
Reference in New Issue
Block a user