Files
sys_manager_ebtp_project/deployment-master.yaml
2025-05-08 10:10:04 +08:00

112 lines
4.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

apiVersion: apps/v1
kind: Deployment
metadata:
name: sys_manager_ebtp_project #[1] Deployment名称可填写微服务名称
namespace: default
labels:
app: sys_manager_ebtp_project
spec:
replicas: 10
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
selector:
matchLabels:
app: sys-manager-ebtp-project #[2] 选择器匹配时标签名称,可填写微服务名称
template:
metadata:
labels:
app: sys-manager-ebtp-project #[3] 模板名称,可填写微服务名称
annotations:
prometheus.io/port: '18012'
prometheus.io/jl-pod: 'true'
spec:
volumes:
- name: log
hostPath:
path: /var/lib/docker/log/349553515466-prod/default-group/30days
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- sys-manager-ebtp-project
topologyKey: "kubernetes.io/hostname"
containers:
- name: sys-manager-ebtp-project #[6] 必选,容器名称,可填写微服务名称
image: harbor.dcos.xixian.unicom.local/eshop/sys-manager-ebtp-project:latest #[7] 镜像名称请把sys-manager-ebtp-project替换为服务名称
args: ["java","-Djava.security.egd=file:/dev/./urandom","-javaagent:/pinpoint/pinpoint-bootstrap-2.0.3.jar","-Dpinpoint.agentId=$(MY_POD_IP)","-Dpinpoint.applicationName=$(APP_NAME)","-Dpinpoint.licence=$(AGENT_LICENCE)","-jar","/app.jar"]
volumeMounts:
- name: log
mountPath: /log
ports:
- containerPort: 18012 #[8] 容器需要监听的端口号与配置文件中的server.port参数相同与参数[4]相同
livenessProbe:
failureThreshold: 3
httpGet:
port: 18012 #[11] pod存活检测端口,修改为该微服务配置文件中server.port的端口号,与参数[5]相同
path: /actuator/health
scheme: HTTP
initialDelaySeconds: 300
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 2
readinessProbe:
failureThreshold: 1
httpGet:
port: 18012 #[12] pod就绪检测端口,修改为该微服务配置文件中server.port的端口号,与参数[5]相同
path: /actuator/health
scheme: HTTP
periodSeconds: 5
successThreshold: 2
timeoutSeconds: 2
resources:
requests:
cpu: 1000m
memory: 2Gi
limits:
cpu: 3000m
memory: 6Gi
env:
- name: APP_NAME
value: biz_ebtp_project #24位长度限制统一去掉service
- name: AGENT_LICENCE
value: 527BFA7B28577578
- name: APOLLO_CONFIGSERVICE
value: http://apollo-configservice:8080
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: JAVA_TOOL_OPTIONS
value: -XX:+UnlockExperimentalVMOptions
-XX:+UseContainerSupport
-XX:+UseCGroupMemoryLimitForHeap
-XX:InitialRAMPercentage=40.0
-XX:MinRAMPercentage=20.0
-XX:MaxRAMPercentage=80.0
---
kind: Service
apiVersion: v1
metadata:
name: sys-manager-ebtp-project-svc # [11] service的名字格式为“服务名-svc”
namespace: default
labels:
service: sys-manager-ebtp-project-svc # [12] service的标签可与参数[11]相同
annotations:
prometheus.io/port: '18012' #[13] prometheus自动发现service的端口也是该微服务所使用的端口与参数[4]相同
prometheus.io/jl-svc: 'true'
spec:
ports:
- port: 18012 #[15] 与参数4相同
targetPort: 18012 #[16] 与参数4相同
selector:
app: sys-manager-ebtp-project #[17] 该service对应Deployment的名字与参数[1]相同
---