Files
biz_service_ebtp_extend/deployment-sim.yaml

104 lines
3.0 KiB
YAML
Raw Permalink Normal View History

2021-01-15 17:43:51 +08:00
# 接口版本
apiVersion: apps/v1
# 接口类型
kind: Deployment
metadata:
name: biz-service-ebtp-extend
namespace: default
labels:
app: biz-service-ebtp-extend
# 必选,详细定义
spec:
# pod 副本数量
2021-05-25 15:52:20 +08:00
replicas: 3
2021-01-15 17:43:51 +08:00
# 滚动升级配置信息
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
# 选择器匹配pod模板
selector:
matchLabels:
app: biz-service-ebtp-extend
template:
metadata:
labels:
# 模板名称
app: biz-service-ebtp-extend
annotations:
prometheus.io/port: '18018'
prometheus.io/jl-pod: 'true'
2021-01-15 17:43:51 +08:00
# 定义容器模板,该模板可以包含多个容器
spec:
volumes:
- name: log
2021-08-02 09:24:29 +08:00
hostPath:
path: /var/lib/docker/log/349553515466-preprod/default-group/all #开发环境
2021-08-20 15:50:02 +08:00
- name: storage
persistentVolumeClaim:
claimName: file-pvc
readOnly: false
2021-05-25 15:52:20 +08:00
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- biz-service-ebtp-extend
topologyKey: "kubernetes.io/hostname"
2021-01-15 17:43:51 +08:00
# 必选Pod中容器列表
containers:
- name: biz-service-ebtp-extend
image: harbor.dcos.guangzhou.unicom.local/eshop/biz-service-ebtp-extend:latest
2021-05-25 15:52:20 +08:00
args: ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/pinpoint/tianyan-springboot-agent/pinpoint-bootstrap-1.8.0.jar", "-Dpinpoint.agentId=$(MY_POD_IP)","-Dpinpoint.applicationName=$(APP_NAME)", "-Dpinpoint.licence=$(AGENT_LICENCE_DEV)", "-jar", "/app.jar"]
2021-01-15 17:43:51 +08:00
volumeMounts:
- name: log
mountPath: /log
2021-08-20 15:50:02 +08:00
- name: storage
mountPath: /storage
2021-01-15 17:43:51 +08:00
ports:
2021-05-25 15:52:20 +08:00
- containerPort: 18018
resources:
requests:
2021-05-25 15:52:20 +08:00
cpu: 1000m
memory: 2Gi
limits:
2021-05-25 15:52:20 +08:00
cpu: 3000m
memory: 6Gi
2021-01-15 17:43:51 +08:00
env:
2021-05-25 15:52:20 +08:00
- name: AGENT_LICENCE
value: 527BFA7B28577578
- name: APP_NAME
value: biz_service_ebtp_extend_sim
2021-01-15 17:43:51 +08:00
- name: APOLLO_CONFIGSERVICE
2021-04-10 11:10:19 +08:00
value: http://apollo-configservice:8080
2021-05-25 15:52:20 +08:00
- name: MY_POD_IP
2021-04-10 11:10:19 +08:00
valueFrom:
fieldRef:
fieldPath: status.podIP
2021-01-15 17:43:51 +08:00
---
kind: Service
apiVersion: v1
metadata:
2021-05-25 15:52:20 +08:00
name: biz-service-ebtp-extend-svc # [11] service的名字格式为“服务名-svc”
2021-01-15 17:43:51 +08:00
namespace: default
labels:
2021-05-25 15:52:20 +08:00
service: biz-service-ebtp-extend-svc # [12] service的标签可与参数[11]相同
2021-01-15 17:43:51 +08:00
annotations:
2021-05-25 15:52:20 +08:00
prometheus.io/port: '18018' #[13] prometheus自动发现service的端口也是该微服务所使用的端口与参数[4]相同
prometheus.io/jl-svc: 'true'
2021-05-25 15:52:20 +08:00
2021-01-15 17:43:51 +08:00
spec:
ports:
2021-05-25 15:52:20 +08:00
- port: 18018 #[15] 与参数4相同
targetPort: 18018 #[16] 与参数4相同
2021-01-15 17:43:51 +08:00
selector:
2021-05-25 15:52:20 +08:00
app: biz-service-ebtp-extend #[17] 该service对应Deployment的名字与参数[1]相同
2021-01-15 17:43:51 +08:00
---