应用性能管理 APM-通过修改deployment.yaml接入APM:操作步骤

时间:2024-11-21 15:55:41

操作步骤

编辑deployment.yaml。

  1. 在volumes中增加一个emptyDir。

    volumes:
    - name: paas-apm2
       emptyDir: {}

  2. 在containers.volumeMounts中增加moutPath。

    volumeMounts:
    - name: paas-apm2
       mountPath: /paas-apm2/javaagent/

  3. 在env中增加JAVA_TOOL_OPTIONS环境变量。

    env:
    - name: JAVA_TOOL_OPTIONS
       value: '-javaagent:/paas-apm2/javaagent/apm-javaagent/apm-javaagent.jar'

  4. 新增initContainers。

    initContainers:
      - name: init-javaagent
        image: {swrAddress}/op_svc_apm/javaagent:{agentVersion}
        command:
          - /bin/sh
          - '-c'
          - cd /paas-apm2/javaagent/apm-javaagent; /bin/sh init-config.sh -master_address {masterAddress} -app_name {appName} -access_key {accessKey} -access_value {secretKey} -business {business} -env {env}
        resources:
          limits:
            cpu: 250m
            memory: 250Mi
           requests:
            cpu: 250m
            memory: 250Mi
         volumeMounts:
          - name: paas-apm2
            mountPath: /var/init/javaagent
         terminationMessagePath: /dev/termination-log
         terminationMessagePolicy: File
         imagePullPolicy: Always
         monitorGroup: default

support.huaweicloud.com/bestpractice-apm2/apm_08_0008.html