- volumes:
- - name: agent-volume
- emptyDir: {}
- initContainers:
- - name: init-apm
- image: site24x7/apminsight-nextjsagent:1.2.0
- imagePullPolicy: Always
- command: ['cp', '-r', '/opt/site24x7/.', '/apm']
- volumeMounts:
- - name: agent-volume
- mountPath: /apm
- containers:
- env:
- - name: NODE_OPTIONS
- value: "--require /apm/node_modules/@apminsight/next"
- - name: APMINSIGHT_LICENSE_KEY
- value: "xxxxxxxxxxxxxxxx"
- - name: APMINSIGHT_APP_NAME
- value: "k8s-nextjs-application"
- - name: APMINSIGHT_APP_PORT
- value: "3001"
- volumeMounts:
- - name: agent-volume
- mountPath: /apm
For applications using the PM2 process manager instead of Kubernetes, enable PM2 support by adding the following in the env section of your deployment YAML file:
- apiVersion: apps/v1
- kind: Deployment
- metadata:
- name: nextjs-app
- namespace: nextjs
- labels:
- app: nextjs-app
- version: v1
- spec:
- replicas: 1
- selector:
- matchLabels:
- app: nextjs-app
- template:
- metadata:
- labels:
- app: nextjs-app
- version: v1
- spec:
- initContainers:
- - name: init-apm
- image: site24x7/apminsight-nextjsagent:1.2.0
- imagePullPolicy: Always
- command: ['cp', '-r', '/opt/site24x7/.', '/apm']
- volumeMounts:
- - name: agent-volume
- mountPath: /apm
- containers:
- - name: nextjs-app
- image: nextjs-sampleapp:latest
- ports:
- - containerPort: 3001
- name: http
- env:
- - name: NODE_OPTIONS
- value: "--require /apm/node_modules/@apminsight/next"
- - name: APMINSIGHT_LICENSE_KEY
- value: "xxxxxxxxxxxxxxxx"
- - name: APMINSIGHT_APP_NAME
- value: "k8s-nextjs-application"
- - name: APMINSIGHT_APP_PORT
- value: "3001"
- imagePullPolicy: Always
- volumeMounts:
- - name: agent-volume
- mountPath: /apm
- volumes:
- - name: agent-volume
- emptyDir: {}
- restartPolicy: Always