208 lines
5.7 KiB
YAML
208 lines
5.7 KiB
YAML
# ===== 1. Secret - 库存服务认证信息 =====
|
|
kind: Secret
|
|
apiVersion: v1
|
|
metadata:
|
|
name: inventory-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: inventory-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: "8004"
|
|
CONTEXT_PATH: "/cpte-wms-inventory"
|
|
|
|
---
|
|
# ===== 3. Service - 库存服务 =====
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: inventory-service
|
|
namespace: cpte-wms
|
|
labels:
|
|
app: inventory-service
|
|
service: cpte-wms-inventory
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: inventory-service
|
|
ports:
|
|
- name: http
|
|
port: 8004
|
|
targetPort: 8004
|
|
protocol: TCP
|
|
|
|
---
|
|
# ===== 4. Deployment - 库存服务 =====
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: inventory-service
|
|
namespace: cpte-wms
|
|
labels:
|
|
app: inventory-service
|
|
service: cpte-wms-inventory
|
|
annotations:
|
|
kubesphere.io/description: "库存服务 - SpringBoot 微服务"
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
maxSurge: 1
|
|
maxUnavailable: 0
|
|
selector:
|
|
matchLabels:
|
|
app: inventory-service
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: inventory-service
|
|
version: v1
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "8004"
|
|
prometheus.io/path: "/cpte-wms-inventory/actuator/prometheus"
|
|
spec:
|
|
containers:
|
|
- name: inventory-service
|
|
image: cpte-registry/cpte-wms-inventory:latest
|
|
imagePullPolicy: IfNotPresent
|
|
command: ["java"]
|
|
args:
|
|
- "-Xms256m"
|
|
- "-Xmx512m"
|
|
- "-XX:+UseG1GC"
|
|
- "-XX:MaxGCPauseMillis=200"
|
|
- "-Dspring.profiles.active=k8s"
|
|
- "-Dserver.port=8004"
|
|
- "-Dserver.servlet.context-path=/cpte-wms-inventory"
|
|
- "-jar"
|
|
- "/app/app.jar"
|
|
ports:
|
|
- containerPort: 8004
|
|
name: http
|
|
protocol: TCP
|
|
env:
|
|
- name: SPRING_PROFILES_ACTIVE
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: inventory-service-config
|
|
key: SPRING_PROFILES_ACTIVE
|
|
- name: TZ
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: inventory-service-config
|
|
key: TZ
|
|
- name: DB_USERNAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: inventory-service-secret
|
|
key: DB_USERNAME
|
|
- name: DB_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: inventory-service-secret
|
|
key: DB_PASSWORD
|
|
- name: REDIS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: inventory-service-secret
|
|
key: REDIS_PASSWORD
|
|
- name: MYSQL_HOST
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: inventory-service-config
|
|
key: MYSQL_HOST
|
|
- name: MYSQL_PORT
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: inventory-service-config
|
|
key: MYSQL_PORT
|
|
- name: MYSQL_DATABASE
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: inventory-service-config
|
|
key: MYSQL_DATABASE
|
|
- name: REDIS_HOST
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: inventory-service-config
|
|
key: REDIS_HOST
|
|
- name: REDIS_PORT
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: inventory-service-config
|
|
key: REDIS_PORT
|
|
volumeMounts:
|
|
- name: inventory-logs
|
|
mountPath: /data/logs
|
|
- name: host-time
|
|
mountPath: /etc/localtime
|
|
readOnly: true
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /cpte-wms-inventory/actuator/health
|
|
port: 8004
|
|
initialDelaySeconds: 90
|
|
periodSeconds: 20
|
|
timeoutSeconds: 10
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /cpte-wms-inventory/actuator/health
|
|
port: 8004
|
|
initialDelaySeconds: 45
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
startupProbe:
|
|
httpGet:
|
|
path: /cpte-wms-inventory/actuator/health
|
|
port: 8004
|
|
initialDelaySeconds: 0
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 30
|
|
resources:
|
|
requests:
|
|
memory: "256Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "1Gi"
|
|
cpu: "500m"
|
|
volumes:
|
|
- name: inventory-logs
|
|
emptyDir: {}
|
|
- name: host-time
|
|
hostPath:
|
|
path: /etc/localtime
|
|
type: File
|
|
restartPolicy: Always
|