用YAML文件创建无状态

apiVersion: v1
kind: Namespace
metadata:
name: biqs
---
apiVersion: v1
kind: ConfigMap
metadata:
name: backend-config
namespace: biqs
data:
SPRING_PROFILES_ACTIVE: prod
MYSQL_HOST: xxxxx
MYSQL_DATABASE: xxxxxxx
MYSQL_USER: xxxxx
MYSQL_PASSWORD: xxxxx
REDIS_HOST: xxxxx
REDIS_PORT: '6379'
REDIS_PASSWORD: xxxxx
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
namespace: biqs
spec:
replicas: 1
selector:
matchLabels:
app: backend
template:
metadata:
labels:
app: backend
spec:
containers:
- name: backend
image: crpi-wgbeewlq79tqfq8r.cn-shanghai.personal.cr.aliyuncs.com/biqs/biqs_backend:latest
ports:
- containerPort: 8082
envFrom:
- configMapRef:
name: backend-config
volumeMounts:
- name: upload-files
mountPath: /app/upload-files
- name: logs
mountPath: /app/logs
volumes:
- name: upload-files
persistentVolumeClaim:
claimName: upload
- name: logs
persistentVolumeClaim:
claimName: log
---
apiVersion: v1
kind: Service
metadata:
name: backend
namespace: biqs
spec:
selector:
app: backend
ports:
- port: 8082
targetPort: 8082
protocol: TCP
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
namespace: biqs
spec:
replicas: 1
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend
image: crpi-wgbeewlq79tqfq8r.cn-shanghai.personal.cr.aliyuncs.com/biqs/biqs_frontend:latest
ports:
- containerPort: 80
env:
- name: VUE_APP_API_BASE_URL
value: http://backend:8082
---
apiVersion: v1
kind: Service
metadata:
name: frontend
namespace: biqs
spec:
selector:
app: frontend
ports:
- port: 8807
targetPort: 80
protocol: TCP
type: NodePort
增加持久化存储

作者:管理员 创建时间:2025-08-15 10:38
最后编辑:管理员 更新时间:2025-08-15 22:22
最后编辑:管理员 更新时间:2025-08-15 22:22