62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: auth-service
|
|
namespace: cloudnest
|
|
labels:
|
|
app: auth-service
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: auth-service
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: auth-service
|
|
spec:
|
|
containers:
|
|
- name: auth-service
|
|
# 替换 yourname 为你的 Docker Hub 用户名
|
|
# 若在服务器本地构建,把 imagePullPolicy 改为 Never
|
|
image: yourname/auth-service:v1
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- containerPort: 8081
|
|
name: http
|
|
env:
|
|
- name: AUTH_PORT
|
|
value: "8081"
|
|
- name: JWT_SECRET
|
|
value: "cloudnest-secret-key"
|
|
- name: MYSQL_DSN
|
|
value: "root:cloudnest123@tcp(mysql:3306)/cloudnest?charset=utf8mb4&parseTime=True&loc=Local"
|
|
- name: REDIS_ADDR
|
|
value: "redis:6379"
|
|
resources:
|
|
limits:
|
|
memory: "128Mi"
|
|
cpu: "300m"
|
|
requests:
|
|
memory: "64Mi"
|
|
cpu: "50m"
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: 8081
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: auth-service
|
|
namespace: cloudnest
|
|
spec:
|
|
selector:
|
|
app: auth-service
|
|
ports:
|
|
- port: 8081
|
|
targetPort: 8081
|
|
name: http
|