Guide to installing and uninstalling kagent on Kubernetes using either the kagent CLI installer or Helm charts, including prerequisites and verification steps
Hello everyone.
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.
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 environmentecho $OPENAI_API_KEY# Example output (truncated for security):# sk-kkAI-7f4db864d4a30df42264af74c22f4f1c5bf51...
Downloading https://cr.kagent.dev/v0.7.7/kagent-linux-amd64Verifying checksum... Done.Preparing to install kagent into /usr/local/binkagent installed into /usr/local/bin/kagent
Trimmed sample output (top-level commands and flags):
kagent is a CLI and TUI for kagentUsage: 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 versionFlags: --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
Ensure the kagent namespace exists (this creates it if absent):
Helm is a common method for installing kagent in production environments. The recommended sequence is: install CRDs first, then install the application Helm chart.
Install the kagent CRDs from the public Helm OCI chart:
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:
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.
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.