Skip to content

Latest commit

 

History

History
179 lines (150 loc) · 7.04 KB

File metadata and controls

179 lines (150 loc) · 7.04 KB

k8s-agents-operator

Version: 0.1.0 Type: application AppVersion: 0.1.0

A Helm chart for the Kubernetes Agents Operator

Homepage: https://github.com/newrelic/k8s-agents-operator/blob/main/charts/k8s-agents-operator/README.md

Prerequisites

Helm must be installed to use the charts. Please refer to Helm's documentation to get started.

Installation

Requirements

Add the jetstack and k8s-agents-operator Helm chart repositories:

helm repo add jetstack https://charts.jetstack.io
helm repo add k8s-agents-operator https://newrelic.github.io/k8s-agents-operator

Install the cert-manager Helm chart:

helm install cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --create-namespace \
  --set installCRDs=true

Instrumentation

Install the k8s-agents-operator Helm chart:

helm upgrade --install k8s-agents-operator k8s-agents-operator/k8s-agents-operator \
  --namespace k8s-agents-operator \
  --create-namespace \
  --values your-custom-values.yaml

Monitored namespaces

For each namespace you want the operator to be instrumented, create a secret containing a valid New Relic ingest license key:

kubectl create secret generic newrelic-key-secret \
  --namespace my-monitored-namespace \
  --from-literal=new_relic_license_key=<NEW RELIC INGEST LICENSE KEY>

Similarly, for each namespace you need to instrument create the Instrumentation custom resource, specifying which APM agents you want to instrument:

apiVersion: newrelic.com/v1alpha1
kind: Instrumentation
metadata:
  labels:
    app.kubernetes.io/name: instrumentation
    app.kubernetes.io/created-by: k8s-agents-operator
  name: newrelic-instrumentation
spec:
  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-arm:latest
  php:
    image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-php:latest

In the example above, we show how you can configure the agent settings globally using ENV variables.

Global agent settings can be overridden in your deployment manifest if a different configuration is required.

Annotations

The k8s-agents-operator looks for language-specific annotations when your pods are being scheduled to know which applications you want to monitor.

Below are the currently supported annotations:

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"

Example deployment with annotation to instrument the Java agent:

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

Available Chart Releases

To see the available charts:

helm search repo k8s-agents-operator

If you want to see a list of all available charts and releases, check index.yaml.

Source Code

Values

Key Type Default Description
admissionWebhooks object {"create":true} Admission webhooks make sure only requests with correctly formatted rules will get into the Operator
controllerManager.kubeRbacProxy.image.repository string "gcr.io/kubebuilder/kube-rbac-proxy"
controllerManager.kubeRbacProxy.image.tag string "v0.14.0"
controllerManager.kubeRbacProxy.resources.limits.cpu string "500m"
controllerManager.kubeRbacProxy.resources.limits.memory string "128Mi"
controllerManager.kubeRbacProxy.resources.requests.cpu string "5m"
controllerManager.kubeRbacProxy.resources.requests.memory string "64Mi"
controllerManager.manager.image.repository string "newrelic/k8s-agents-operator"
controllerManager.manager.image.tag string nil
controllerManager.manager.leaderElection object {"enabled":true} Enable leader election mechanism for protecting against split brain if multiple operator pods/replicas are started
controllerManager.manager.resources.requests.cpu string "100m"
controllerManager.manager.resources.requests.memory string "64Mi"
controllerManager.manager.serviceAccount.create bool true
controllerManager.replicas int 1
kubernetesClusterDomain string "cluster.local"
metricsService.ports[0].name string "https"
metricsService.ports[0].port int 8443
metricsService.ports[0].protocol string "TCP"
metricsService.ports[0].targetPort string "https"
metricsService.type string "ClusterIP"
securityContext object {"fsGroup":65532,"runAsGroup":65532,"runAsNonRoot":true,"runAsUser":65532} SecurityContext holds pod-level security attributes and common container settings
webhookService.ports[0].port int 443
webhookService.ports[0].protocol string "TCP"
webhookService.ports[0].targetPort int 9443
webhookService.type string "ClusterIP"

Maintainers

Name Email Url
juanjjaramillo https://github.com/juanjjaramillo
csongnr https://github.com/csongnr
dbudziwojskiNR https://github.com/dbudziwojskiNR

Autogenerated from chart metadata using helm-docs v1.13.1