The Kubernetes Agent runs inside your cluster and listens for Kubernetes resource events.
It uses the controller-runtime library to create controllers that watch for changes in resources (e.g., Pods, Deployments, Jobs).
Whenever an event occurs, the agent forwards the details to our backend service for further processing and analysis.
To enforce the commit message format, you should install the pre-commit tool with pip or homebrew. For every clone (i.e., worktree) of the code, the install command of pre-commit needs to be run to set up the hook correctly.
brew install pre-commit
pre-commit install- Runs as a lightweight pod inside your Kubernetes cluster
- Watches Kubernetes resources using
controller-runtimecontrollers - Sends create/update/delete events to the backend
You can run the agent locally against your current Kubernetes context (~/.kube/config).
Before running the agent, set the following:
export POD_NAME="kubernetes-agent-rs001-001"
export AGENT_NAMESPACE="aikido"
export ENVIRONMENT="local"The agent expects a config file (YAML) containing authentication and backend information:
apiToken: '<your-api-token>'
apiEndpoint: 'http://localhost:8082'Save this file as config.yaml (the name needs to match the config parameter send to the program).
Run the agent with the config file path as a program argument:
go run cmd/main.go --config=config.yamlDeploy the agent to a local Minikube cluster using a locally built image and the Helm chart.
Prerequisites: Minikube is installed and running (
minikube start), Docker is installed.
This ensures the image you build is placed inside Minikube’s Docker registry, so the cluster can pull it without pushing to a remote registry.
eval $(minikube docker-env)After this, all docker commands run against the Docker daemon inside the Minikube VM.
Build (and tag) the container image used by the Helm release. The --platform flag ensures compatibility with the Minikube node’s architecture.
docker buildx build --platform linux/amd64 -t kubernetes-agent:$imageTag .Use Helm to install the chart, passing your API endpoint and token at install time.
This command will create a new namespace called aikido if it doesn’t already exist and install the agent components.
helm install kubernetes-agent ./kubernetes-agent -n aikido \
--set image.repository=kubernetes-agent:$imageTag \
--set config.apiEndpoint=$apiEndpoint \
--set config.apiToken=$apiToken \
--create-namespace