80 lines
1.8 KiB
YAML
80 lines
1.8 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
labels:
|
|
app: $APP_NAME
|
|
version: $TAG
|
|
name: $APP_NAME
|
|
namespace: dl-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: /test
|
|
port: 13145
|
|
timeoutSeconds: 10
|
|
failureThreshold: 30
|
|
periodSeconds: 5
|
|
imagePullPolicy: Always
|
|
name: app
|
|
ports:
|
|
- containerPort: 13145
|
|
protocol: TCP
|
|
resources:
|
|
limits:
|
|
cpu: 99m
|
|
memory: 65Mi
|
|
terminationMessagePath: /dev/termination-log
|
|
terminationMessagePolicy: File
|
|
env:
|
|
- name: TZ
|
|
value: "Asia/Shanghai"
|
|
dnsPolicy: ClusterFirst
|
|
restartPolicy: Always
|
|
terminationGracePeriodSeconds: 30
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
labels:
|
|
app: $APP_NAME
|
|
name: $APP_NAME
|
|
namespace: dl-proj
|
|
spec:
|
|
ports:
|
|
- name: http
|
|
port: 13145
|
|
protocol: TCP
|
|
targetPort: 13145
|
|
selector:
|
|
app: $APP_NAME
|
|
sessionAffinity: None
|
|
type: ClusterIP
|
|
---
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: $APP_NAME # ServiceAccount的名字
|
|
namespace: dl-proj # serviceaccount的namespace
|
|
labels:
|
|
app: $APP_NAME #ServiceAccount的标签
|