Files
dailyLove/deployment-temp.yml

71 lines
1.7 KiB
YAML
Raw Normal View History

2023-11-23 12:59:54 +08:00
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
2023-11-23 15:08:12 +08:00
app: $APP_NAME
2026-01-05 18:08:25 +08:00
version: $APP_TAG
2023-11-23 15:08:12 +08:00
name: $APP_NAME
namespace: default #一定要写名称空间
2023-11-23 12:59:54 +08:00
spec:
progressDeadlineSeconds: 600
replicas: 1
2026-01-05 18:08:25 +08:00
revisionHistoryLimit: 2
2023-11-23 12:59:54 +08:00
selector:
matchLabels:
2023-11-23 15:08:12 +08:00
app: $APP_NAME
2023-11-23 12:59:54 +08:00
strategy:
rollingUpdate:
maxSurge: 50%
maxUnavailable: 50%
type: RollingUpdate
template:
metadata:
labels:
2023-11-23 15:08:12 +08:00
app: $APP_NAME
2026-01-05 18:08:25 +08:00
version: $APP_TAG
2023-11-23 12:59:54 +08:00
spec:
imagePullSecrets:
2026-01-05 18:08:25 +08:00
- name: dockerhub-id #提前在项目下配置访问阿里云的账号密码
2023-11-23 12:59:54 +08:00
containers:
2026-01-05 18:08:25 +08:00
- image: $REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$APP_TAG
name: $APP_NAME
imagePullPolicy: Always
livenessProbe: # 存活探针:失败意味着应用彻底挂了,需要重启来恢复
2023-11-23 12:59:54 +08:00
httpGet:
2023-11-23 15:38:44 +08:00
path: /test
port: 13145
2026-01-05 18:08:25 +08:00
initialDelaySeconds: 10 # 延迟xx秒开始执行
periodSeconds: 15 # 每隔15秒执行一次
timeoutSeconds: 10 # 10秒未返回结果则超时
failureThreshold: 10 # 探测失败后的重试次数,当达到这个次数后就判定结果为失败
# successThreshold: 5
2023-11-23 12:59:54 +08:00
ports:
- containerPort: 13145
protocol: TCP
resources:
limits:
2023-11-28 00:55:23 +08:00
cpu: 99m
2023-11-30 23:25:26 +08:00
memory: 65Mi
2023-11-23 15:45:57 +08:00
env:
- name: TZ
value: "Asia/Shanghai"
2026-01-05 18:08:25 +08:00
2023-11-23 12:59:54 +08:00
---
apiVersion: v1
kind: Service
metadata:
labels:
2023-11-23 15:08:12 +08:00
app: $APP_NAME
name: $APP_NAME
namespace: default
2023-11-23 12:59:54 +08:00
spec:
2026-01-05 18:08:25 +08:00
type: NodePort
externalTrafficPolicy: Local
2023-11-23 12:59:54 +08:00
ports:
- name: http
protocol: TCP
2026-01-05 18:08:25 +08:00
port: 13145
nodePort: 30045
2023-11-23 12:59:54 +08:00
selector:
2023-11-23 15:08:12 +08:00
app: $APP_NAME