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:
Verify the environment variable is set:

Quick comparison


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):
Example installer output:
  1. Confirm the installed kagent version:
Example output:
  1. Inspect available CLI commands and flags:
Trimmed sample output (top-level commands and flags):
  1. Ensure the kagent namespace exists (this creates it if absent):
  1. Install kagent into the kagent namespace. The installer will use the OPENAI_API_KEY environment variable (no additional flag required for the key):
Example confirmation:
  1. Verify the deployed pods in the kagent namespace:
Example output (trimmed):

Uninstalling kagent (CLI)

To remove the kagent installation created via the CLI:
Example output:

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:
Example output (trimmed):
  1. Verify the CRDs are present:
Example output:
  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:
  1. Verify Helm releases:
Example output:
  1. Confirm services and pods are running:
Example services (trimmed):
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:
Example output:
  1. Uninstall the CRDs Helm release:
Example output:
  1. Confirm the namespace no longer contains kagent resources:
Example output:

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