☸️ Deploying the Helios OpenTelemetry SDK in a Kubernetes (K8s) cluster
Follow the instructions below to install and update the Helios OpenTelemetry SDK in a centralized manner when running multiple containers by leveraging deployment with Kubernetes operator.
In order to install Helios in your K8s cluster, you need to perform the following steps:
- Install the OpenTelemetry K8s operator
- Install the Helios instrumentation resource
- Add instrumentation annotations to your Deployments
Install the OpenTelemetry Kubernetes operator
Start by deploying the OpenTelemetry Kubernetes operator in your cluster by calling:
kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml
Install the Helios instrumentation resource
Install the Helios instrumentation resource in your cluster by calling:
kubectl apply -f - <<EOF
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: helios-instrumentation
spec:
nodejs:
image: gethelios/helios-nodejs-autoinstrumentation
python:
image: gethelios/helios-python-autoinstrumentation
EOF
Helios instrumentation resource supports currently Node.js and python services
Add instrumentation annotations to your Deployments
Now, edit the Deployments you wish to instrument by adding annotations
under spec/template/metadata
:
annotations:
instrumentation.opentelemetry.io/inject-nodejs: "true"
instrumentation.opentelemetry.io/inject-python: "true"
Alternatively you can use the kubectl
command to add the annotation to a Deployment:
kubectl patch deployment DEPLOYMENT_NAME -p '{"spec": {"template":{"metadata":{"annotations":{"instrumentation.opentelemetry.io/inject-nodejs": "true", instrumentation.opentelemetry.io/inject-python: "true"}}}} }'
Configure environment variables
Finally, add the following environment variables to your Deployments config:
env:
- name: HS_TOKEN
value: your helios token (get this after signing up to Helios)
- name: HS_SERVICE_NAME
value: your service name
- name: HS_ENVIRONMENT
value: your environment name
If you wish to add the environment variables to all Deployments in the cluster use:
kubectl set env deployment --all HS_TOKEN=<YOUR_HELIOS_TOKEN> HS_ENVIRONMENT=<YOUR_ENV_NAME>
Redeploy your Deployments and you should be all set to get instrumented data from Helios.
Updated about 2 months ago