🎉 Join us at the MCP and Agents Community Party at KubeCon Atlanta on Nov 12
Documentation

kagent deploy#

Deploy an agent to Kubernetes.

kagent deploy [project-directory] [flags]

Arguments:

  • project-directory - The directory containing the agent project with kagent.yaml

Flags:

  • --api-key - API key for the model provider (convenience option to create secret)
  • --api-key-secret - Name of existing secret containing API key (recommended)
  • --dry-run - Output YAML manifests without applying them to the cluster
  • --image, -i - Image to use (defaults to localhost:5001/{agentName}:latest)
  • --namespace - Kubernetes namespace to deploy to

Global Flags:

  • --kagent-url - kagent URL (default: "http://localhost:8083")
  • --output-format, -o - Output format (default: "table")
  • --timeout - Timeout duration (default: 300s)
  • --verbose, -v - Verbose output

About kagent deploy#

The kagent deploy command deploys an agent to Kubernetes by performing the following steps:

  1. Loads the agent configuration from kagent.yaml
  2. Either creates a new secret with the provided API key or verifies an existing secret
  3. Creates an Agent Custom Resource Definition (CRD) with the appropriate configuration

API Key Options:

  • --api-key: Convenience option to create a new secret with the provided API key
  • --api-key-secret: Recommended way to reference an existing secret by name

Dry-Run Mode: Use the --dry-run flag to output YAML manifests without applying them to the cluster. This is useful for previewing changes or for use with GitOps workflows.

Example#

Deploy using an existing secret:

kagent deploy ./my-agent --api-key-secret "my-existing-secret"

Deploy and create a new secret:

kagent deploy ./my-agent --api-key "your-api-key-here" --image "myregistry/myagent:v1.0"

Deploy to a specific namespace:

kagent deploy ./my-agent --api-key-secret "my-secret" --namespace "my-namespace"

Generate manifests without deploying:

kagent deploy ./my-agent --api-key "your-api-key" --dry-run > manifests.yaml
Kagent Lab: Discover kagent and kmcp
Free, on‑demand lab: build custom AI agents with kagent and integrate tools via kmcp on Kubernetes.