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:
flowchart LR
GIT(["Git push"])
CI["GitHub Actions<br/>build plus test"]
REG[("Container registry<br/>GHCR or ECR")]
HELM["Helm chart<br/>values per env"]
K8S{"Kubernetes cluster"}
DEP["Deployment<br/>rolling update"]
SVC["Service plus Ingress"]
HPA["HPA<br/>CPU and queue depth"]
POD[("Inference pods<br/>GPU node pool")]
USERS(["Production traffic"])
GIT --> CI --> REG --> HELM --> K8S
K8S --> DEP --> POD
K8S --> SVC --> POD
K8S --> HPA --> POD
SVC --> USERS
style CI fill:#4f46e5,stroke:#4338ca,color:#fff
style POD fill:#ede9fe,stroke:#7c3aed,color:#1e1b4b
style USERS fill:#059669,stroke:#047857,color:#fff
helm create ai-agent
This generates the following structure:
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
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: [email protected]
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:
# 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:
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
# 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
Try CallSphere AI Voice Agents
See how AI voice agents work for your industry. Live demo available -- no signup required.