---
title: "Ruby APM with Kubernetes"
slug: "ruby-apm-with-kubernetes"
description: "Learn how to install Ruby APM Profiler on Kubernetes. Follow our guide, add Stackify APM GEM, configure, and verify performance in Retrace dashboard."
updated: 2020-06-18T20:40:01Z
published: 2020-06-18T20:40:01Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ruby APM with Kubernetes

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

## Prerequisite

Follow the [Retrace Kubernetes Install](/docs/retrace-kubernetes-install) Guide.

## Ruby Kubernetes Setup

### Add Stackify Ruby APM GEM

**Add the Stackify APM GEM to each application to monitor.** Modify application `Gemfile`:

```
gem 'stackify-ruby-apm'
```

### Configure Application

Add `config/stackify_apm.yml` to your application, modify **application_name** and **environment_name**.

```
application_name: 'Ruby Application'
environment_name: 'Production'
```

#### Rails

Profiler will startup automatically, no additional configuration.

#### Non-Rails

Include **StackifyRubyAPM::Middleware** when starting your application:

```
# config.ru

require 'stackify-ruby-apm'
use StackifyRubyAPM::Middleware
StackifyRubyAPM.start

# application startup

at_exit { StackifyRubyAPM.stop }
```

### Pod Configuration

Application containers are required to have the **stackify** volume mount configured in [Retrace Kubernetes Install](/docs/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.
