Files
dailyLove/deploy.yaml
2023-11-23 13:46:49 +08:00

78 lines
1.7 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: $APP_NAME
version: $TAG
name: $APP_NAME
namespace: my-proj #一定要写名称空间
spec:
progressDeadlineSeconds: 600
replicas: 1
selector:
matchLabels:
app: $APP_NAME
strategy:
rollingUpdate:
maxSurge: 50%
maxUnavailable: 50%
type: RollingUpdate
template:
metadata:
labels:
app: $APP_NAME
version: $TAG
spec:
imagePullSecrets:
- name: aliyun-docker-hub #提前在项目下配置访问阿里云的账号密码
containers:
- image: $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG
readinessProbe:
httpGet:
path: /actuator/health
port: 8080
timeoutSeconds: 10
failureThreshold: 30
periodSeconds: 5
imagePullPolicy: Always
name: app
ports:
- containerPort: 13145
protocol: TCP
resources:
limits:
cpu: 300m
memory: 120Mib
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
labels:
app: $APP_NAME
version: $TAG
name: $APP_NAME
namespace: my-proj
spec:
ports:
- name: http
port: 13146
protocol: TCP
targetPort: 13146
selector:
app: $APP_NAME
sessionAffinity: None
type: ClusterIP
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: $APP_NAME # ServiceAccount的名字
namespace: my-proj # serviceaccount的namespace
labels:
app: $APP_NAME #ServiceAccount的标签