From ed7ce1279a32f3b6c4f9c85a5e3ce76209d356a7 Mon Sep 17 00:00:00 2001 From: bamanker Date: Thu, 23 Nov 2023 12:59:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86k8s=20devops?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.yaml | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 deploy.yaml diff --git a/deploy.yaml b/deploy.yaml new file mode 100644 index 0000000..6ac82c9 --- /dev/null +++ b/deploy.yaml @@ -0,0 +1,76 @@ +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 + 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的标签