98 lines
1.8 KiB
YAML
98 lines
1.8 KiB
YAML
# 1. 创建一个独立的命名空间,保持整洁
|
||
apiVersion: v1
|
||
kind: Namespace
|
||
metadata:
|
||
name: monitoring
|
||
|
||
---
|
||
|
||
# 2. 申请一块 10GB 的硬盘 (使用 Longhorn)
|
||
apiVersion: v1
|
||
kind: PersistentVolumeClaim
|
||
metadata:
|
||
name: kuma-pvc
|
||
namespace: monitoring
|
||
spec:
|
||
accessModes:
|
||
- ReadWriteOnce
|
||
storageClassName: longhorn
|
||
resources:
|
||
requests:
|
||
storage: 2Gi
|
||
|
||
---
|
||
|
||
# 3. 部署应用 (StatefulSet 也可以用 Deployment,单实例用 Deployment 足够)
|
||
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: uptime-kuma
|
||
namespace: monitoring
|
||
spec:
|
||
replicas: 1
|
||
selector:
|
||
matchLabels:
|
||
app: uptime-kuma
|
||
strategy:
|
||
type: Recreate
|
||
template:
|
||
metadata:
|
||
labels:
|
||
app: uptime-kuma
|
||
spec:
|
||
containers:
|
||
- name: uptime-kuma
|
||
image: louislam/uptime-kuma:1
|
||
ports:
|
||
- containerPort: 3001
|
||
volumeMounts:
|
||
- name: data
|
||
mountPath: /app/data
|
||
volumes:
|
||
- name: data
|
||
persistentVolumeClaim:
|
||
claimName: kuma-pvc
|
||
|
||
---
|
||
|
||
# 4. 创建内部服务
|
||
apiVersion: v1
|
||
kind: Service
|
||
metadata:
|
||
name: kuma-service
|
||
namespace: monitoring
|
||
spec:
|
||
selector:
|
||
app: uptime-kuma
|
||
ports:
|
||
- protocol: TCP
|
||
port: 80
|
||
targetPort: 3001
|
||
|
||
---
|
||
|
||
# 5. 暴露到外网 (HTTPS + 域名)
|
||
apiVersion: networking.k8s.io/v1
|
||
kind: Ingress
|
||
metadata:
|
||
name: kuma-ingress
|
||
namespace: monitoring
|
||
annotations:
|
||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||
spec:
|
||
rules:
|
||
- host: status.u9.net3w.com # <--- 您的新域名
|
||
http:
|
||
paths:
|
||
- path: /
|
||
pathType: Prefix
|
||
backend:
|
||
service:
|
||
name: kuma-service
|
||
port:
|
||
number: 80
|
||
tls:
|
||
- hosts:
|
||
- status.u9.net3w.com
|
||
secretName: status-tls-secret
|