Skip to main content
Hello everyone.
A presentation slide titled "Kagent Installation" with a dark curved shape on the right containing the word "Demo." A small "© Copyright KodeKloud" appears in the bottom-left corner.
Welcome to this lesson. Here you’ll learn two ways to install kagent on Kubernetes:
  • Using the kagent CLI installer, and
  • Using Helm charts (recommended for cluster-managed installations).
Objective: be able to install and uninstall kagent with either method and choose the best approach for your environment.

Prerequisites

  • A Kubernetes cluster and kubectl configured to target it.
  • Helm installed if you plan to use the Helm method.
  • An LLM provider API key (the examples below use OpenAI). Export your OpenAI key into the environment so the installer can pick it up automatically.
Make sure your OPENAI_API_KEY is set in the environment before installing kagent. You can export it like:
export OPENAI_API_KEY="sk-..."
Verify the environment variable is set:
# Verify the key is available in the environment
echo $OPENAI_API_KEY
# Example output (truncated for security):
# sk-kkAI-7f4db864d4a30df42264af74c22f4f1c5bf51...

Quick comparison

Installation MethodBest forKey command
CLI installerLocal testing, quick installs`curl -fsSL https://raw.githubusercontent.com/kagent-dev/kagent/refs/heads/main/scripts/get-kagentbash`
Helm chartProduction or cluster-managed installshelm install kagent oci://ghcr.io/kagent-dev/kagent/helm/kagent

CLI-based installation

Follow these steps to install kagent using the kagent CLI installer.
  1. Install the kagent CLI (the installer fetches the latest stable binary):
curl -fsSL https://raw.githubusercontent.com/kagent-dev/kagent/refs/heads/main/scripts/get-kagent | bash
Example installer output:
Downloading https://cr.kagent.dev/v0.7.7/kagent-linux-amd64
Verifying checksum... Done.
Preparing to install kagent into /usr/local/bin
kagent installed into /usr/local/bin/kagent
  1. Confirm the installed kagent version:
kagent version
Example output:
{"backend_version":"unknown","build_date":"2025-12-11","git_commit":"bfe15ba","kagent_version":"0.7.7"}
  1. Inspect available CLI commands and flags:
kagent --help
Trimmed sample output (top-level commands and flags):
kagent is a CLI and TUI for kagent

Usage:
  kagent [flags]
  kagent [command]

Available Commands:
  add-mcp        Add an MCP server entry to kagent.yaml
  bug-report     Generate a bug report
  build          Build a Docker images for an agent project
  completion     Generate the autocompletion script for the specified shell
  dashboard      Open the kagent dashboard
  deploy         Deploy an agent to Kubernetes
  get            Get a kagent resource
  help           Help about any command
  init           Initialize a new agent project
  install        Install kagent
  invoke         Invoke a kagent agent
  mcp            MCP (Model Context Protocol) server management
  run            Run agent project locally with docker-compose and launch chat interface
  uninstall      Uninstall kagent
  version        Print the kagent version

Flags:
      --config string           config file (default is $HOME/.kagent/config.yaml)
  -h, --help                    help for kagent
      --kagent-url string       KAgent URL (default "http://localhost:8083")
  -n, --namespace string        Namespace (default "kagent")
  -o, --output-format string    Output format (default "table")
      --timeout duration        Timeout (default 5m0s)
  -v, --verbose                 Verbose output
  1. Ensure the kagent namespace exists (this creates it if absent):
kubectl create namespace kagent --dry-run=client -o yaml | kubectl apply -f -
  1. Install kagent into the kagent namespace. The installer will use the OPENAI_API_KEY environment variable (no additional flag required for the key):
kagent install -n kagent
Example confirmation:
kagent installed successfully
  1. Verify the deployed pods in the kagent namespace:
kubectl get pods -n kagent
Example output (trimmed):
NAME                                                   READY   STATUS    RESTARTS   AGE
argo-rollouts-conversion-agent-6b75f48f84-skzsc        1/1     Running   0          40s
cilium-debug-agent-5c7798b559-9bbzh                    1/1     Running   0          40s
cilium-manager-agent-5dc4964899-2vkn4                  0/1     Running   0          40s
helm-agent-66d7fd5fb8-dvbr6                            0/1     Running   0          40s
kagent-controller-6886fc4f5c-wn2xm                     1/1     Running   0          97s
kagent-grafana-mcp-5cc85fd598-hw6bk                    1/1     Running   0          97s
kagent-kmcp-controller-manager-76645f577f-n2r5v        1/1     Running   0          97s
kagent-querydoc-5f6fd94c98-64kxn                       1/1     Running   0          97s
kagent-tools-56c49d7d4d-6h8zg                          1/1     Running   0          97s
kagent-ui-59d5bbd564-r7j5q                             1/1     Running   0          97s
kgateway-agent-d97c5f7d-5qg2c                          0/1     Running   0          40s
observability-agent-55d64bd489-987hm                   1/1     Running   0          40s
promql-agent-56c56b98bd-xvlzw                          0/1     Running   0          39s

Uninstalling kagent (CLI)

To remove the kagent installation created via the CLI:
kagent uninstall -n kagent
Example output:
Warning: kagent release not found, skipping uninstallation
Warning: kagent-crds release not found, try to delete crds directly
Successfully deleted CRD agents.kagent.dev
Successfully deleted CRD modelconfigs.kagent.dev
Successfully deleted CRD toolservers.kagent.dev

kagent uninstalled successfully

Helm-based installation

Helm is a common method for installing kagent in production environments. The recommended sequence is: install CRDs first, then install the application Helm chart.
  1. Install the kagent CRDs from the public Helm OCI chart:
helm install kagent-crds oci://ghcr.io/kagent-dev/kagent/helm/kagent-crds \
  --namespace kagent \
  --create-namespace
Example output (trimmed):
Pulled: ghcr.io/kagent-dev/kagent/helm/kagent-crds:0.7.7
Digest: sha256:9e3a92d7636bf1485fb1de984d579543fd7c1bb8dc57312401e462edc209df91
I1215 09:13:10.543041 47158 warnings.go:110] "Warning: unrecognized format \"int64\""
NAME: kagent-crds
LAST DEPLOYED: Mon Dec 15 09:13:10 2025
NAMESPACE: kagent
STATUS: deployed
REVISION: 1
  1. Verify the CRDs are present:
kubectl get crd | grep kagent
Example output:
agents.kagent.dev                      2025-12-15T09:13:10Z
mcpservers.kagent.dev                  2025-12-15T09:13:10Z
memories.kagent.dev                    2025-12-15T09:13:10Z
modelconfigs.kagent.dev                2025-12-15T09:13:10Z
remotemcpservers.kagent.dev            2025-12-15T09:13:10Z
toolservers.kagent.dev                 2025-12-15T09:13:10Z
  1. Install the kagent Helm chart. Pass the OpenAI API key via Helm values so components can use it. The exact value key name may vary by chart — one common pattern is openai.apiKey. Replace with the correct key for your chart if different:
helm install kagent oci://ghcr.io/kagent-dev/kagent/helm/kagent \
  --namespace kagent \
  --set openai.apiKey="$OPENAI_API_KEY"
  1. Verify Helm releases:
helm list -n kagent
Example output:
NAME        NAMESPACE   REVISION   UPDATED                                 STATUS    CHART                 APP VERSION
kagent      kagent      1          2025-12-15 09:14:04.750303641 +0000 UTC deployed  kagent-0.7.7
kagent-crds kagent      1          2025-12-15 09:13:10.339038232 +0000 UTC deployed  kagent-crds-0.7.7
  1. Confirm services and pods are running:
kubectl get svc -n kagent
kubectl get pods -n kagent
Example services (trimmed):
service/kagent-controller                  8083/TCP
service/kagent-grafana-mcp                8000/TCP
service/kagent-querydoc                   8080/TCP
service/kagent-tools                      8084/TCP
service/kagent-ui                         8080/TCP
service/kgateway-agent                    8080/TCP
service/observability-agent               8080/TCP
service/promql-agent                      8080/TCP
When removing kagent, uninstall the application release first and remove CRDs separately. Deleting CRDs before removing dependent resources can leave orphaned resources or break uninstall workflows.

Uninstalling Helm release and CRDs

  1. Uninstall the kagent release:
helm uninstall kagent -n kagent
Example output:
release "kagent" uninstalled
  1. Uninstall the CRDs Helm release:
helm uninstall kagent-crds -n kagent
Example output:
release "kagent-crds" uninstalled
  1. Confirm the namespace no longer contains kagent resources:
kubectl get pods -n kagent
Example output:
No resources found in kagent namespace.

Conclusion

This lesson covered how to install and uninstall kagent using:
  • the kagent CLI (quick installer + kagent install), and
  • Helm charts (install CRDs first, then the application chart).
Choose CLI for quick experimentation and Helm for production/cluster-managed deployments. After installation, you can explore the kagent UI, interact with deployed agents, and configure providers via the kagent configuration.

Watch Video

Practice Lab