Node.js APM with Kubernetes
  • 1 Minute to read
  • Dark
    Light
  • PDF

Node.js APM with Kubernetes

  • Dark
    Light
  • PDF

Article Summary

This document details how to install the Node.js APM Profiler in your Node.js application running on Kubernetes.

Prerequisite

Follow the Retrace Kubernetes Install Guide.

Node.js Kubernetes Setup

Add Stackify APM Module

Add the Stackify APM module to each application to monitor.

npm install stackify-node-apm --save

Configure Application

Copy node_modules/stackify-node-apm/stackify.js into your application's root directory and modify Application Name and Environment Name.

Initialize Profiler

Add require('stackify-node-apm') to the top of your application's main module.

Pod Configuration

Application containers are required to have the stackify volume mount configured in Retrace Kubernetes Install.

Example Application Pod YAML:

apiVersion: v1
kind: ReplicationController
metadata:
  name: pod-name
spec:
  replicas: 1
  selector:
    app: app-name
  template:
    metadata:
      name: template-name
      labels:
        app: app-name
    spec:
      containers:
      - name: container-name
        image: application-image
        volumeMounts:
          - mountPath: /usr/local/stackify
            name: stackify
      volumes:
        - name: stackify
          hostPath: 
            path: /var/stackify
            type: DirectoryOrCreate

Verify

Make application requests, you can then verify results in the Retrace dashboard.


Was this article helpful?