Cpte-Boot/k8s/services/outbound-service.yaml

208 lines
5.7 KiB
YAML
Raw Normal View History

2026-03-20 17:07:12 +08:00
# ===== 1. Secret - 出库服务认证信息 =====
kind: Secret
apiVersion: v1
metadata:
name: outbound-service-secret
namespace: cpte-wms
annotations:
kubesphere.io/creator: admin
kubesphere.io/description: 出库服务认证信息
data:
DB_USERNAME: cm9vdA==
DB_PASSWORD: Y3B0ZUAxMjM=
REDIS_PASSWORD: Y3B0ZUAxMjM=
SWAGGER_USERNAME: Y3B0ZV9hZG1pbg==
SWAGGER_PASSWORD: Y3B0ZV9zZWN1cmVfMjAyNA==
SIGNATURE_SECRET: ZGQwNWYxYzU0ZDYzNzQ5ZWRhOTVmOWZhNmQ0OXY0NDJh
type: Opaque
---
# ===== 2. ConfigMap - 出库服务环境变量配置 =====
kind: ConfigMap
apiVersion: v1
metadata:
name: outbound-service-config
namespace: cpte-wms
annotations:
kubesphere.io/creator: admin
kubesphere.io/description: 出库服务环境变量配置
data:
SPRING_PROFILES_ACTIVE: "k8s"
TZ: "Asia/Shanghai"
JAVA_OPTS: "-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
MYSQL_HOST: "mysql-service"
MYSQL_PORT: "3306"
MYSQL_DATABASE: "cpte-wms"
REDIS_HOST: "redis-service"
REDIS_PORT: "6379"
SERVER_PORT: "8003"
CONTEXT_PATH: "/cpte-wms-outbound"
---
# ===== 3. Service - 出库服务 =====
apiVersion: v1
kind: Service
metadata:
name: outbound-service
namespace: cpte-wms
labels:
app: outbound-service
service: cpte-wms-outbound
spec:
type: ClusterIP
selector:
app: outbound-service
ports:
- name: http
port: 8003
targetPort: 8003
protocol: TCP
---
# ===== 4. Deployment - 出库服务 =====
2026-03-16 23:52:17 +08:00
apiVersion: apps/v1
kind: Deployment
metadata:
2026-03-20 17:07:12 +08:00
name: outbound-service
2026-03-16 23:52:17 +08:00
namespace: cpte-wms
labels:
2026-03-20 17:07:12 +08:00
app: outbound-service
service: cpte-wms-outbound
annotations:
kubesphere.io/description: "出库服务 - SpringBoot 微服务"
2026-03-16 23:52:17 +08:00
spec:
2026-03-20 17:07:12 +08:00
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
2026-03-16 23:52:17 +08:00
selector:
matchLabels:
2026-03-20 17:07:12 +08:00
app: outbound-service
2026-03-16 23:52:17 +08:00
template:
metadata:
labels:
2026-03-20 17:07:12 +08:00
app: outbound-service
version: v1
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8003"
prometheus.io/path: "/cpte-wms-outbound/actuator/prometheus"
2026-03-16 23:52:17 +08:00
spec:
containers:
2026-03-20 17:07:12 +08:00
- name: outbound-service
image: cpte-registry/cpte-wms-outbound:latest
imagePullPolicy: IfNotPresent
command: ["java"]
args:
- "-Xms256m"
- "-Xmx512m"
- "-XX:+UseG1GC"
- "-XX:MaxGCPauseMillis=200"
- "-Dspring.profiles.active=k8s"
- "-Dserver.port=8003"
- "-Dserver.servlet.context-path=/cpte-wms-outbound"
- "-jar"
- "/app/app.jar"
ports:
- containerPort: 8003
name: http
protocol: TCP
env:
- name: SPRING_PROFILES_ACTIVE
valueFrom:
configMapKeyRef:
name: outbound-service-config
key: SPRING_PROFILES_ACTIVE
- name: TZ
valueFrom:
configMapKeyRef:
name: outbound-service-config
key: TZ
- name: DB_USERNAME
valueFrom:
secretKeyRef:
name: outbound-service-secret
key: DB_USERNAME
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: outbound-service-secret
key: DB_PASSWORD
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: outbound-service-secret
key: REDIS_PASSWORD
- name: MYSQL_HOST
valueFrom:
configMapKeyRef:
name: outbound-service-config
key: MYSQL_HOST
- name: MYSQL_PORT
valueFrom:
configMapKeyRef:
name: outbound-service-config
key: MYSQL_PORT
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
name: outbound-service-config
key: MYSQL_DATABASE
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: outbound-service-config
key: REDIS_HOST
- name: REDIS_PORT
valueFrom:
configMapKeyRef:
name: outbound-service-config
key: REDIS_PORT
volumeMounts:
- name: outbound-logs
mountPath: /data/logs
- name: host-time
mountPath: /etc/localtime
readOnly: true
livenessProbe:
httpGet:
path: /cpte-wms-outbound/actuator/health
port: 8003
initialDelaySeconds: 90
periodSeconds: 20
timeoutSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /cpte-wms-outbound/actuator/health
port: 8003
initialDelaySeconds: 45
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
startupProbe:
httpGet:
path: /cpte-wms-outbound/actuator/health
port: 8003
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 30
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "1Gi"
cpu: "500m"
2026-03-16 23:52:17 +08:00
volumes:
2026-03-20 17:07:12 +08:00
- name: outbound-logs
emptyDir: {}
- name: host-time
hostPath:
path: /etc/localtime
type: File
restartPolicy: Always