kubernetes配置pod的jvm参数

  sre

5fc7ac328bfb19598.jpg_fo742.jpg
通过引用limits.memory来给jvm传值:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: jenkins-master         
spec:
  template:
    metadata:
      labels:
        app: jenkins
    spec:
      terminationGracePeriodSeconds: 10     
      serviceAccount: jenkins            
      containers:
      - name: jenkins
      ...
        resources:
          limits:
            cpu: 1000m
            memory: 1Gi
          requests:
            cpu: 500m
            memory: 512Mi


        env:
        - name: LIMITS_MEMORY
          valueFrom:
            resourceFieldRef:
              resource: limits.memory
              divisor: 1Mi
        - name: JAVA_OPTS
          value: -Xmx$(LIMITS_MEMORY)m -XshowSettings:vm -Dhudson.slaves.NodeProvisioner.initialDelay=0 -Dhudson.slaves.NodeProvisioner.MARGIN=50 -Dhudson.slaves.NodeProvisioner.MARGIN0=0.85 -Duser.timezone=Asia/Shanghai
      ...  

LEAVE A COMMENT

Captcha Code