kubernetes-agent

by OneUptime

Helm chartv17.3.0App 17.3.0Apache-2.0Verified publisher

OneUptime Kubernetes Monitoring Agent — collects cluster metrics, events, and logs via OpenTelemetry and sends them to your OneUptime instance.

About this chart

OneUptime Kubernetes Agent

Collects cluster metrics, events, pod logs, application traces (HTTP/gRPC via eBPF), and OS-level node metrics from your Kubernetes cluster and ships them to OneUptime via OpenTelemetry. Install with one helm install command — no code changes or per-app SDK setup needed to see service traffic. Continuous CPU profiles (eBPF flame graphs) are also available — opt in with --set profiling.enabled=true.

Full docs: Install the Kubernetes Agent.

Quick start

helm repo add oneuptime https://helm-chart.oneuptime.com
helm repo update

helm install kubernetes-agent oneuptime/kubernetes-agent \
  --namespace oneuptime-agent --create-namespace \
  --set oneuptime.url=https://oneuptime.com \
  --set oneuptime.apiKey=<YOUR_API_KEY> \
  --set clusterName=<A_UNIQUE_NAME_FOR_THIS_CLUSTER> \
  --set aiAgent.enabled=true

Your cluster appears in OneUptime within a few minutes.

AI investigations are on by default. aiAgent.enabled=true — the chart's default, spelled out above — runs the Kubernetes AI agent, so OneUptime AI investigates incidents and alerts on this cluster with read-only kubectl and changes nothing. Fixes stay off until you allow them. To install without it, use --set aiAgent.enabled=false instead.

Pick a preset

The preset option picks compatible defaults for your Kubernetes distribution — so you don't have to think about hostPath, Pod Security Standards, or which log collection mode to use.

presetUse forLog collection
standard (default)Self-managed, EKS on EC2, GKE Standard, AKS, minikube, kind, k3sDaemonSet reading /var/log/pods via hostPath (lowest overhead)
gke-autopilotGKE AutopilotKubernetes API log tailer Deployment (no hostPath)
eks-fargateEKS FargateKubernetes API log tailer Deployment (no hostPath)
openshiftOpenShift: OpenShift Container Platform, ROSA, ARO, OKDDaemonSet reading /var/log/pods via hostPath, under a security context constraint (SCC) the chart creates for it
openshift-restrictedOpenShift, where an admin will not add an SCCKubernetes API log tailer Deployment (no hostPath)

On gke-autopilot and eks-fargate the preset also leaves out the eBPF auto-instrumentation and the continuous profiler, whatever ebpf.enabled and profiling.enabled say. Both run a privileged pod on every node: GKE Autopilot refuses privileged pods, and EKS Fargate runs neither privileged pods nor DaemonSets. To get application traces there, send them from your services with an OpenTelemetry SDK. openshift-restricted leaves them out too: see below.

GKE Autopilot:

helm install kubernetes-agent oneuptime/kubernetes-agent \
  --namespace oneuptime-agent --create-namespace \
  --set oneuptime.url=https://oneuptime.com \
  --set oneuptime.apiKey=<YOUR_API_KEY> \
  --set clusterName=prod \
  --set aiAgent.enabled=true \
  --set preset=gke-autopilot

EKS Fargate:

helm install kubernetes-agent oneuptime/kubernetes-agent \
  --namespace oneuptime-agent --create-namespace \
  --set oneuptime.url=https://oneuptime.com \
  --set oneuptime.apiKey=<YOUR_API_KEY> \
  --set clusterName=prod \
  --set aiAgent.enabled=true \
  --set preset=eks-fargate

OpenShift:

helm install kubernetes-agent oneuptime/kubernetes-agent \
  --namespace oneuptime-agent --create-namespace \
  --set oneuptime.url=https://oneuptime.com \
  --set oneuptime.apiKey=<YOUR_API_KEY> \
  --set clusterName=prod \
  --set aiAgent.enabled=true \
  --set preset=openshift

OpenShift admits a pod only under an SCC its service account may use, and until an admin grants more, that is restricted-v2 (OpenShift 4.11 and later): no hostPath volumes, no privileged containers, and user IDs from the namespace's own range only. On the openshift preset the chart:

  • Creates two SCCs, each used only by its pods' own service account. For a release named kubernetes-agent:
    • kubernetes-agent-node-collector, for the node collector: read-only hostPath mounts, as root with the SELinux type spc_t, since pod log files are not world-readable and RHCOS enforces SELinux. It stays unprivileged, with every capability dropped.
    • kubernetes-agent-ebpf, for the eBPF auto-instrumentation and the continuous profiler: privileged, in the host's PID namespace. Only while ebpf.enabled or profiling.enabled is on.
  • Lets OpenShift assign the user and group IDs of every other pod, which then runs under restricted-v2.
  • Stamps oneuptime.kubernetes.distribution=openshift on the agent's telemetry, and turns on the collector's openshift resource detector, which adds cloud.provider and cloud.platform (for example aws_openshift) on a cloud.

Creating the SCCs takes cluster-admin rights, as the chart's ClusterRole already does. With serviceAccount.create=false, every pod runs as the service account you name, and both SCCs are granted to it.

OpenShift, where an admin will not add an SCC:

helm install kubernetes-agent oneuptime/kubernetes-agent \
  --namespace oneuptime-agent --create-namespace \
  --set oneuptime.url=https://oneuptime.com \
  --set oneuptime.apiKey=<YOUR_API_KEY> \
  --set clusterName=prod \
  --set aiAgent.enabled=true \
  --set preset=openshift-restricted

openshift is the recommended preset on OpenShift. openshift-restricted is for a cluster whose admin will not add one: the chart creates no SCC and every pod runs under restricted-v2, the way gke-autopilot works. It is still OpenShift to the agent: unpinned user IDs, the oneuptime.kubernetes.distribution stamp, the openshift resource detector and OpenShift's own objects stay. What it gives up:

  • Pod logs from the nodes. The log tailer reads them through the Kubernetes API, which costs one long-lived API connection per container.
  • Host metrics (hostMetrics): disk I/O, filesystem inodes, NIC errors, paging and load average read the node's /proc and /sys. Node, pod and container metrics stay: the node collector still reads each kubelet and cAdvisor over the network.
  • eBPF traces and the continuous profiler, whatever ebpf.enabled and profiling.enabled say. To get application traces, send them from your services with an OpenTelemetry SDK.
  • Audit logs (auditLogs), which are read from the node.

To get them back, move to openshift with --set preset=openshift on an upgrade, as a cluster admin.

Control plane on OpenShift. On both presets, --set controlPlane.enabled=true is enough for the API server, the scheduler and the controller manager. OpenShift runs several replicas of each behind a Service, so the chart finds every replica in the Service's EndpointSlices and scrapes it on its own, with the service account's token, in the jobs kube-scheduler and kube-controller-manager. Reading EndpointSlices is added to the ClusterRole only then. controlPlane.<component>.endpoints, when you set them, win for that component, and setting controlPlane.<component>.insecureSkipVerify=false checks each replica's certificate against OpenShift's service CA.

etcd asks for a client certificate, so it has a job only once controlPlane.etcd.clientCertSecret names a Secret that holds one. Copy OpenShift's own, as a cluster admin:

oc extract secret/etcd-metric-client --namespace openshift-etcd-operator --to=etcd-cert --confirm
oc extract configmap/etcd-metric-serving-ca --namespace openshift-etcd-operator --to=etcd-cert --confirm
oc create secret generic etcd-client-cert --namespace oneuptime-agent \
  --from-file=ca.crt=etcd-cert/ca-bundle.crt \
  --from-file=tls.crt=etcd-cert/tls.crt \
  --from-file=tls.key=etcd-cert/tls.key
rm -r etcd-cert
helm upgrade kubernetes-agent oneuptime/kubernetes-agent \
  --namespace oneuptime-agent --reset-then-reuse-values \
  --set controlPlane.enabled=true \
  --set controlPlane.etcd.clientCertSecret=etcd-client-cert

The copy does not follow OpenShift's rotation of that certificate: run these again when etcd's metrics stop. A hosted control plane (ROSA with HCP, HyperShift) has no such pods in the cluster, so discovery finds nothing and those metrics stay empty; nothing else changes.

If you try the default standard preset on a cluster that blocks hostPath, the install fails with a Pod Security error. Re-install with --set preset=gke-autopilot (or eks-fargate) and it works. On OpenShift the install itself succeeds, but the pods that need more than restricted-v2 are never created; the install notes say so, and --set preset=openshift fixes it.

Kubernetes AI agent (AI investigations and fixes)

When an incident or alert is raised on this cluster, OneUptime AI investigates it. The Kubernetes AI agent gives it a terminal: it runs read-only kubectl the way an on-call engineer would (describe the failing pod, read its events, tail the crashing container's logs, check node capacity) and shows every command it ran on the incident page.

It is on by default, and read-only. It is one small pod (image oneuptime/kubernetes-ai-agent) that connects with the same oneuptime.apiKey and clusterName as the rest of the chart, so there is nothing to set up in the dashboard: the cluster's AI → Agent page shows it as Connected within a minute. To turn it off, pass --set aiAgent.enabled=false.

To add it to an existing install, refresh the chart index first and then upgrade:

helm repo update
helm upgrade kubernetes-agent oneuptime/kubernetes-agent \
  --namespace oneuptime-agent --reset-then-reuse-values \
  --set aiAgent.enabled=true

kubernetes-agent in oneuptime-agent is the release name and namespace every command here, the docs and the OneUptime dashboard use. If you installed with other names (older versions of this README and the docs used oneuptime-agent in oneuptime-kubernetes-agent), use yours; helm list -A | grep kubernetes-agent shows them. Skip helm repo update and Helm may resolve an older chart, which does not know aiAgent and fails with Additional property aiAgent is not allowed.

Good to know:

  • Self-hosted OneUptime: upgrade the server first. The agent needs a OneUptime server of this chart's version or newer. On an older server it logs that the server has no Kubernetes AI agent API and keeps retrying every few minutes. (The chart's eBPF tracer also wants a current server — see Upgrading.)
  • Not connecting? The agent's log says why — whether a refusal clears on its own (while a previous agent pod, or the in-cluster Runner it replaces, is still shutting down) or what you need to change: kubectl logs -n oneuptime-agent -l component=ai-agent --tail=100. An API key with a Pinned Service Name cannot register the agent; give the chart a key without one.
  • It is not a OneUptime Runner. It never appears on the Runners page, never gets a Kubernetes credential, and never runs runbooks or Bash/SSH steps: it uses its own ServiceAccount only. It is also not related to the "AI Agent" retired in OneUptime 12.
  • Egress proxy? Set HTTPS_PROXY and NO_PROXY with aiAgent.extraEnv.
  • Private registry or mirror? Set aiAgent.image.repository (and aiAgent.imagePullSecrets).

What OneUptime AI may do: aiAgent.investigation and aiAgent.fixes

What OneUptime AI may do on the cluster is set here, in the chart, and the cluster's AI → Agent page shows it read-only — its Change button shows these commands for the option you pick:

  • aiAgent.investigation — true: AI runs read-only kubectl (get, describe, logs, events, top) while it investigates an incident or alert on the cluster. false: it still investigates, with the data OneUptime already has.
  • aiAgent.fixes — what AI does when it finds a fix: off, ask-for-approval, automatic or bypass-approval (below). Every level but off grants the agent the write RBAC described below; off grants none.

The agent reports both to OneUptime, which applies them to the cluster and refuses a change made anywhere else (the AI → Agent page, the API, Terraform). Both are unset in values.yaml on purpose: a release that sets neither lets the agent use its defaults (investigation on; fixes ask-for-approval with the deprecated aiAgent.remediation.enabled, else off), and OneUptime applies those only to a cluster whose settings nobody chose on its AI → Agent page — settings chosen there stay as they are until you set them here.

Let OneUptime AI fix what it finds (optional)

Pick how fixes run and, recommended, only the namespaces AI may change:

helm repo update
helm upgrade kubernetes-agent oneuptime/kubernetes-agent \
  --namespace oneuptime-agent --reset-then-reuse-values \
  --set aiAgent.enabled=true \
  --set aiAgent.investigation=true \
  --set aiAgent.fixes=ask-for-approval \
  --set "aiAgent.remediation.namespaces={web,api}" \
  --set aiAgent.remediation.nodeOperations=false

Or cluster-wide:

helm repo update
helm upgrade kubernetes-agent oneuptime/kubernetes-agent \
  --namespace oneuptime-agent --reset-then-reuse-values \
  --set aiAgent.enabled=true \
  --set aiAgent.investigation=true \
  --set aiAgent.fixes=ask-for-approval \
  --set-json 'aiAgent.remediation.namespaces=[]'

To turn fixes off again, upgrade with --set aiAgent.fixes=off: the write RBAC is removed and the agent refuses every write.

Every namespace you list must already exist. The chart creates one RoleBinding in each and never creates a namespace, so a missing one fails the whole install or upgrade — the collector's workload

Deploy kubernetes-agent with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has kubernetes-agent on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartkubernetes-agent is pinned at v17.3.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply