| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- apiVersion: apps/v1
- kind: Deployment
- metadata:
- name: <service_name><service_version>
- namespace: ahxpm
- spec:
- strategy:
- type: RollingUpdate
- rollingUpdate:
- maxSurge: 1 # 每次只新增 1 个 Pod(逐步替换)
- maxUnavailable: 0 # 确保任何时刻所有 Pod 都可用
- minReadySeconds: 60 # 新 Pod Ready 后至少保持 60 秒才认为更新完成
- selector:
- matchLabels:
- app: <service_name><service_version>
- template:
- metadata:
- labels:
- app: <service_name><service_version>
- annotations:
- commit-sha: "<COMMIT_SHA>"
- spec:
- terminationGracePeriodSeconds: 120 # 默认30秒,延长至60秒或其他值
- imagePullSecrets:
- - name: <imagePullSecret>
- containers:
- - name: <service_name>
- image: <docker_image>
- command: ["java"]
- args: <java_args>
- readinessProbe:
- httpGet:
- path: <service_health>
- port: 80
- initialDelaySeconds: 15
- periodSeconds: 30
- failureThreshold: 3
- ports:
- - name: http
- containerPort: 80
- envFrom:
- - configMapRef:
- name: <configmap_env_name>
|