Files
myk3sTest/deployment-temp.yml
2025-12-29 22:58:14 +08:00

63 lines
1.5 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: $APP_NAME
version: $APP_TAG
name: $APP_NAME
namespace: default
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: $APP_NAME
strategy:
rollingUpdate:
maxSurge: 50%
maxUnavailable: 50%
type: RollingUpdate
template:
metadata:
labels:
app: $APP_NAME
version: $APP_TAG
spec:
containers:
- image: $REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$APP_TAG
name: $APP_NAME
imagePullPolicy: Always
livenessProbe: # 存活探针:失败意味着应用彻底挂了,需要重启来恢复
httpGet:
path: /test
port: 9090
initialDelaySeconds: 10 # 延迟xx秒开始执行
periodSeconds: 15 # 每隔15秒执行一次
timeoutSeconds: 10 # 10秒未返回结果则超时
failureThreshold: 10 # 探测失败后的重试次数,当达到这个次数后就判定结果为失败
# successThreshold: 5
ports:
- containerPort: 9090
imagePullSecrets:
- name: dockerhub-id
---
apiVersion: v1
kind: Service
metadata:
labels:
app: $APP_NAME
name: $APP_NAME
namespace: default
spec:
type: NodePort
externalTrafficPolicy: Local
ports:
- name: http
protocol: TCP
port: 9090
nodePort: 30909
selector:
app: $APP_NAME