Skip to content
Learn Agentic AI12 min read0 views

Helm Charts for AI Agent Deployment: Templated, Reusable Kubernetes Manifests

Build Helm charts for AI agent deployments — including chart structure, values files, Go templates, dependencies, and chart repositories for reusable, parameterized Kubernetes manifests.

Why Helm for AI Agent Deployments

Deploying an AI agent to Kubernetes requires multiple resources: a Deployment, Service, ConfigMap, Secret, HPA, NetworkPolicy, and possibly PVCs and Ingress. Managing these as individual YAML files across development, staging, and production environments creates duplication and drift. Helm packages all resources into a single chart with parameterized values, making deployments repeatable and environment-specific configuration simple.

Chart Structure

Create a new Helm chart:

helm create ai-agent

This generates the following structure:

ai-agent/
  Chart.yaml          # Chart metadata
  values.yaml         # Default configuration values
  templates/
    deployment.yaml   # Deployment template
    service.yaml      # Service template
    hpa.yaml          # Autoscaler template
    configmap.yaml    # ConfigMap template
    _helpers.tpl      # Reusable template helpers
    NOTES.txt         # Post-install instructions

Chart.yaml: Metadata

# Chart.yaml
apiVersion: v2
name: ai-agent
description: Helm chart for deploying AI agents to Kubernetes
type: application
version: 0.1.0
appVersion: "1.0.0"
keywords:
  - ai
  - agent
  - llm
maintainers:
  - name: AI Platform Team
    email: platform@example.com

values.yaml: Parameterized Defaults

# values.yaml
replicaCount: 2

image:
  repository: myregistry/ai-agent
  tag: "1.0.0"
  pullPolicy: IfNotPresent

agent:
  modelName: "gpt-4o"
  temperature: 0.7
  maxTokens: 4096
  logLevel: "INFO"
  systemPrompt: |
    You are a helpful AI assistant.
    Answer questions accurately and concisely.

resources:
  requests:
    memory: "512Mi"
    cpu: "250m"
  limits:
    memory: "2Gi"
    cpu: "1000m"

autoscaling:
  enabled: true
  minReplicas: 2
  maxReplicas: 20
  targetCPUUtilization: 60

service:
  type: ClusterIP
  port: 80
  targetPort: 8000

ingress:
  enabled: false
  hostname: agent.example.com
  tls: true

persistence:
  enabled: false
  storageClass: "fast-ssd"
  size: "50Gi"

Deployment Template

# templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "ai-agent.fullname" . }}
  labels:
    {{- include "ai-agent.labels" . | nindent 4 }}
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "ai-agent.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "ai-agent.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - containerPort: {{ .Values.service.targetPort }}
          envFrom:
            - configMapRef:
                name: {{ include "ai-agent.fullname" . }}-config
            - secretRef:
                name: {{ include "ai-agent.fullname" . }}-secrets
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
          {{- if .Values.persistence.enabled }}
          volumeMounts:
            - name: agent-data
              mountPath: /data
          {{- end }}
      {{- if .Values.persistence.enabled }}
      volumes:
        - name: agent-data
          persistentVolumeClaim:
            claimName: {{ include "ai-agent.fullname" . }}-data
      {{- end }}

The checksum/config annotation triggers a rolling restart whenever the ConfigMap changes, ensuring Pods always use the latest configuration.

Helper Templates

# templates/_helpers.tpl
{{- define "ai-agent.fullname" -}}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "ai-agent.labels" -}}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "ai-agent.selectorLabels" -}}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

Environment-Specific Values

Create override files for each environment:

See AI Voice Agents Handle Real Calls

Book a free demo or calculate how much you can save with AI voice automation.

# values-production.yaml
replicaCount: 5
image:
  tag: "1.2.0"
agent:
  modelName: "gpt-4o"
  logLevel: "WARNING"
resources:
  requests:
    memory: "1Gi"
    cpu: "500m"
  limits:
    memory: "4Gi"
    cpu: "2000m"
autoscaling:
  enabled: true
  minReplicas: 5
  maxReplicas: 50
ingress:
  enabled: true
  hostname: agent.prod.example.com

Deploy with environment-specific values:

# Development
helm install agent-dev ./ai-agent -n ai-dev -f values-dev.yaml

# Production
helm install agent-prod ./ai-agent -n ai-prod -f values-production.yaml

# Upgrade with new image tag
helm upgrade agent-prod ./ai-agent -n ai-prod \
  -f values-production.yaml \
  --set image.tag="1.3.0"

Chart Dependencies

Include sub-charts for common infrastructure:

# Chart.yaml
dependencies:
  - name: redis
    version: "18.x.x"
    repository: "https://charts.bitnami.com/bitnami"
    condition: redis.enabled
  - name: postgresql
    version: "13.x.x"
    repository: "https://charts.bitnami.com/bitnami"
    condition: postgresql.enabled
helm dependency update ./ai-agent

FAQ

How do I manage secrets in Helm without committing them to version control?

Never put actual secret values in values.yaml. Use helm-secrets with SOPS encryption, which encrypts values files at rest and decrypts them during deployment. Alternatively, create Secrets separately via a secrets manager and reference them by name in your Helm templates. For CI/CD pipelines, inject secrets as environment variables and use --set flags.

How do I roll back a failed AI agent Helm deployment?

Helm maintains release history. Run helm rollback agent-prod 1 to revert to revision 1. Kubernetes performs a rolling update back to the previous Pod spec. Always test with helm upgrade --dry-run before applying changes to production. Set --history-max to control how many revisions Helm retains.

Can I use Helm to deploy multiple AI agents from a single chart?

Yes. Install the same chart multiple times with different release names and values files. For example, deploy a triage agent and a specialist agent from the same base chart by overriding image.tag, agent.systemPrompt, and agent.modelName in separate values files. This reduces maintenance since infrastructure logic is defined once and parameterized per agent.


#Helm #Kubernetes #AIDeployment #InfrastructureAsCode #DevOps #AgenticAI #LearnAI #AIEngineering

Share this article
C

CallSphere Team

Expert insights on AI voice agents and customer communication automation.

Try CallSphere AI Voice Agents

See how AI voice agents work for your industry. Live demo available -- no signup required.