添加CPU内存资源限制,防止服务部署异常

This commit is contained in:
王皓昱
2021-05-15 14:22:51 +08:00
parent fab63c6ba7
commit b51f6eed90

View File

@ -53,6 +53,13 @@ spec:
# 需要暴露的端口库号列表
ports:
- containerPort: 18018
resources:
requests:
cpu: 2000m
memory: 4Gi
limits:
cpu: 4000m
memory: 8Gi
# 容器运行前需设置的环境变量列表
env:
# Apollo 配置中心变量设置
@ -61,7 +68,14 @@ spec:
- name: MY_POD_IP #自动获取pod ip作为agent id
valueFrom:
fieldRef:
fieldPath: status.podIP
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