Skip to content

Commit

Permalink
Cleanup and organize README.md
Browse files Browse the repository at this point in the history
Migrating detailed install and configuration instructions to a dedicated docs directory.
  • Loading branch information
bpschmitt authored Apr 12, 2024
1 parent fc65908 commit a0a24e9
Showing 1 changed file with 9 additions and 120 deletions.
129 changes: 9 additions & 120 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,135 +1,24 @@
<a href="https://opensource.newrelic.com/oss-category/#new-relic-experimental"><picture><source media="(prefers-color-scheme: dark)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Experimental.png"><source media="(prefers-color-scheme: light)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Experimental.png"><img alt="New Relic Open Source experimental project banner." src="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Experimental.png"></picture></a>

# newrelic-agent-operator
<strong>newrelic-agent-operator</strong> is an implementation of the [opentelemetry-operator](https://github.com/open-telemetry/opentelemetry-operator), that manages auto-instrumentation of the workloads using New Relic APM agents.
The <strong>newrelic-agent-operator</strong> is an implementation of the [Opentelemetry Operator](https://github.com/open-telemetry/opentelemetry-operator) that auto-instruments containerized workloads in Kubernetes with New Relic APM agents.

## Description
If you are looking for an automated way to enable New Relic APM agents for applications running in your Kubernetes cluster, then you are in the right place. This will guide you in configuring APM agents in seamless manner. The idea behind the <strong>newrelic-agent-operator</strong> is to provide simple and efficient installation to the users. It uses a Kubernetes operator to create and configure a custom resource called <strong>Instrumentation</strong>. This custom resource provides higher-level abstraction for language specific agent configuration(s) in the Kubernetes cluster. Also, the underlying <strong>newrelic-agent-operator</strong> leverages Init containers to execute the required one-time agent setup, enabling seamless auto-instrumentation functionality.
## Documentation

## Pre-requisites
- [New Relic Agent Operator docs](./docs)

- [Cert Manager](https://cert-manager.io/docs/installation/) will need to be installed in your cluster
## Prerequisites

## Installation
You’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) or [Minikube](https://minikube.sigs.k8s.io/docs/start/) to get a local cluster for testing, or run against a remote cluster.
**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).
Currently, the New Relic Agent Operator requires [Cert Manager](https://cert-manager.io/docs/installation/) to be installed in your cluster.

1. Install newrelic-agent-operator using the helm chart
```sh
helm upgrade --install newrelic-agent-operator chart/ --set licenseKey='ABCD1234XYZ' -n newrelic --create-namespace
```

2. Create a secret containing your New Relic license key within your namespace.

```
kubectl create secret generic newrelic-key-secret -n my-namespace --from-literal=new_relic_license_key=ABCD1234XYZ
```

3. Configure and Install the Instrumentation custom resource. This is a namespaced resource so each namespace will need an `Instrumentation` resource defined within it.

```sh
kubectl apply -f config/samples/instrumentation_v1alpha1_instrumentation.yaml -n my-namespace
```

Example `Instrumentation` custom resource:

```
---
apiVersion: newrelic.com/v1alpha1
kind: Instrumentation
metadata:
labels:
app.kubernetes.io/name: instrumentation
app.kubernetes.io/created-by: newrelic-agent-operator
name: newrelic-instrumentation
spec:
# A required but separate opentelemetry collector is required for go autoinstrumentation set to 4318.
# exporter:
# endpoint: http://opentelemetry-collector.newrelic:4318
# propagators:
# - tracecontext
# sampler:
# type: always_on
# resource:
# resourceAttributes:
# cluster.name: "newrelic-operator-demo"
java:
image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-java:latest
env:
# Example New Relic agent supported environment variables
- name: NEW_RELIC_LABELS
value: "environment:auto-injection"
# Example overriding the appName configuration
# - name: NEW_RELIC_POD_NAME
# valueFrom:
# fieldRef:
# fieldPath: metadata.name
# - name: NEW_RELIC_APP_NAME
# value: "$(NEW_RELIC_LABELS)-$(NEW_RELIC_POD_NAME)"
nodejs:
image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-nodejs:latest
python:
image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-python:latest
dotnet:
image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-dotnet:latest
php:
image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-php:latest
go:
image: ghcr.io/open-telemetry/opentelemetry-go-instrumentation/autoinstrumentation-go:latest
```

## Getting Started

In order to enable auto-instrumentation for your application, you'll need to add the appropriate annotation to your deployment manifest.

```
instrumentation.newrelic.com/inject-java: "true"
instrumentation.newrelic.com/inject-nodejs: "true"
instrumentation.newrelic.com/inject-python: "true"
instrumentation.newrelic.com/inject-dotnet: "true"
instrumentation.newrelic.com/inject-php: "true"
instrumentation.newrelic.com/inject-go: "true"
```

Below is an example Java deployment:
## Helm Charts
You can install the New Relic Agent Operator via Helm from the newrelic-agent-operator repository. Visit the installation docs for more info.

```
apiVersion: apps/v1
kind: Deployment
metadata:
name: spring-petclinic
spec:
selector:
matchLabels:
app: spring-petclinic
replicas: 1
template:
metadata:
labels:
app: spring-petclinic
annotations:
instrumentation.newrelic.com/inject-java: "true"
spec:
containers:
- name: spring-petclinic
image: ghcr.io/pavolloffay/spring-petclinic:latest
ports:
- containerPort: 8080
env:
- name: NEW_RELIC_APP_NAME
value: spring-petclinic-demo
helm repo add newrelic-agent-operator https://newrelic-experimental.github.io/newrelic-agent-operator
helm upgrade --install newrelic-agent-operator newrelic-agent-operator/newrelic-agent-operator --set licenseKey='<NEW RELIC INGEST LICENSE KEY>' -n newrelic
```

After deploying your application, ensure the operator successfully injected the language-specific instrumentation initContainer.

```
$ kubectl get pod spring-petclinic-7fcccbcbd6-qm8kr -n my-namespace -o jsonpath='{.spec.initContainers[*].name}'
newrelic-instrumentation
```

Finally, login to your [New Relic](https://one.newrelic.com/) account and locate your APM application name under `Services - APM`.


## Building

1. Build and push your image to the location specified by `IMG`:
Expand Down

0 comments on commit a0a24e9

Please sign in to comment.