Skip to main content

Sensor on Kubernetes

Install on Kubernetes

Prerequisites

Before installing the Sensor on Kubernetes, ensure you have:

  • Kubernetes version >= v1.18.0
  • Helm v3 installed and configured
  • The Kubernetes cluster API endpoint is reachable from the machine running Helm
  • kubectl access to the cluster with cluster-admin permissions

1. Add the Levo Helm Repository

helm repo add levoai https://charts.levo.ai && helm repo update levoai

2. Create the levoai Namespace and Install the Sensor

# Replace 'hostname|IP' & 'port' with the values you noted down from the Satellite installation
# If the Sensor is installed on the same cluster as the Satellite, use 'levoai-haproxy'
# If they are installed on different clusters, the haproxy service should be exposed so that it is
# reachable by the Sensor. Use the exposed address as the value for satellite-url.
# Also specify the Organization ID and Workspace ID (copy from the Levo platform).
#
helm upgrade levoai-sensor levoai/levoai-ebpf-sensor \
--install \
--namespace levoai \
--create-namespace \
--set sensor.orgId=<your-org-id> \
--set sensor.workspaceId=<your-workspace-id> \
--set sensor.satelliteUrl=levoai-haproxy \
--set sensor.levoEnv=<Application environment>
info

You need to expose the levoai-haproxy service so that the Sensor can reach the Satellite when it is installed in a different cluster. The installation command will be:

helm upgrade levoai-sensor levoai/levoai-ebpf-sensor \
--install \
--namespace levoai \
--create-namespace \
--set sensor.satelliteUrl=<hostname|IP:port> \
--set sensor.levoEnv=<Application environment>

3. Verify Connectivity with Satellite

a. Check Sensor Health

Check the health of the Sensor by executing the following:

kubectl -n levoai get pods | grep levoai-sensor

If the Sensor is healthy, you should see output similar to the following:

levoai-sensor-747fb4aaa9-gv8g9   1/1     Running   0             1m8s

b. Check Connectivity

Execute the following command to check connectivity health:

# Please specify the actual pod name for levoai-sensor below
kubectl -n levoai logs <levoai-sensor pod name> | grep "Initial connection with Collector"

If connectivity is healthy, you should see output similar to the following:

2022/06/13 21:15:40 729071	INFO [ebpf_sensor.cpp->main:120]	Initial connection with Collector was successful.

Please contact support@levo.ai if you encounter health or connectivity errors.

NOTE:

The default satellite URL in Helm installations is levoai-haproxy.

This address assumes that the Satellite is installed in the same cluster (and namespace) as the Sensor. If they are installed on different clusters, the haproxy service should be exposed so that it is reachable by the Sensor. Use the exposed address as the value for satellite-url.

Alternatively, you may request Levo to host the Satellite for you. In this case, set the satellite-url to https://collector.levo.ai and specify an Organization ID (organization-id) and Workspace ID (workspace-id) via Helm values:

helm upgrade --set sensor.levoEnv=<your-application-environment> --set sensor.satelliteUrl=https://collector.levo.ai --set sensor.orgId=<your-org-id> --set sensor.workspaceId=<your-workspace-id> levoai-sensor levoai/levoai-ebpf-sensor -n levoai

If there are no errors, proceed to the next step.


Using a Private Docker Registry for Kubernetes Installations (Optional)

If you want to use a private Docker registry for the Sensor installation, refer to Using a Private Docker Registry for Kubernetes Installations.

Optimizing Resource Usage for Levo eBPF Sensor

Resource requests and limits help ensure the Sensor runs efficiently and reliably in your Kubernetes cluster. You can tune these settings to match your environment’s needs and available resources.

1. Configure CPU and Memory Requests/Limits

The Sensor’s resource settings are defined in the Helm chart under sensor.containerResources. You can override these values during installation or upgrade:

  • Requests: Minimum resources guaranteed for the container.
  • Limits: Maximum resources the container can use.

Example values.yaml section:

sensor:
containerResources:
requests:
cpu: 0.5
memory: 1Gi
limits:
cpu: 1.0
memory: 2Gi

2. Set Resource Values via Helm

To customize resource allocation, use the following flags with your Helm command:

helm upgrade --install -n levoai levoai-sensor levoai/levoai-ebpf-sensor \
--set sensor.containerResources.requests.cpu=0.25 \
--set sensor.containerResources.limits.cpu=0.5 \
--set sensor.containerResources.requests.memory=512Mi \
--set sensor.containerResources.limits.memory=1Gi

You can adjust the values (cpu, memory) to fit your cluster’s capacity and workload.

3. Verify Resource Settings

After deployment, check the resource settings applied to the Sensor pod:

kubectl -n levoai get pod <levoai-sensor-pod-name> -o jsonpath='{.spec.containers[*].resources}'

4. Tips for Tuning

  • Monitor Usage: Use kubectl top pod or your cluster’s monitoring tools to observe actual resource consumption.
  • Adjust Gradually: Start with conservative values and increase if you notice throttling or OOM (Out Of Memory) errors.
  • Cluster Constraints: Ensure your node types and quotas can support the requested resources.

For further assistance with resource optimization, contact support@levo.ai.