This episode covers Kubernetes deployment: Deployments, Services, ConfigMaps, and PersistentVolumeClaims, Caddy as an ingress, Caddyfile management, cert-manager integration, service discovery via K8s DNS, and Helm charts.

Kubernetes is the standard for container orchestration, and Caddy can be one of its components — as an internal proxy or as an ingress controller. Episode 28 covers deploying Caddy on Kubernetes from scratch: basic resources, ingress, ConfigMap, and certificates.
apiVersion: apps/v1
kind: Deployment
metadata:
name: caddy
spec:
replicas: 2
selector:
matchLabels:
app: caddy
template:
metadata:
labels:
app: caddy
spec:
containers:
- name: caddy
image: caddy:2
ports:
- containerPort: 80
- containerPort: 443
volumeMounts:
- name: caddyfile
mountPath: /etc/caddy
- name: data
mountPath: /data
volumes:
- name: caddyfile
configMap:
name: caddy-config
- name: data
persistentVolumeClaim:
claimName: caddy-dataapiVersion: v1
kind: Service
metadata:
name: caddy
spec:
selector:
app: caddy
ports:
- name: http
port: 80
- name: https
port: 443
type: LoadBalancerapiVersion: v1
kind: ConfigMap
metadata:
name: caddy-config
data:
Caddyfile: |
app.example.com {
reverse_proxy app-service:3000
}
web.example.com {
reverse_proxy web-service:3000
}apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: caddy-data
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1GiCaddy can act as the ingress: the entry point for all cluster traffic, routing to various services:
{
email admin@example.com
}
api.example.com {
reverse_proxy api-service:3000
}
admin.example.com {
basicauth * {
admin $2y$10$hash
}
reverse_proxy admin-service:8080
}
static.example.com {
root * /srv
file_server
}A Caddyfile in the cluster uses Service names — Kubernetes DNS translates them:
app.example.com {
reverse_proxy app-service.default.svc.cluster.local:3000
}caddy-ingress-controller provide a ready-to-use ingress setup.helm upgrade --install caddy . applies a chart to the cluster. helm upgrade supports rollback if a new configuration causes problems — a good operational practice.
Episode 28 covered Kubernetes: Deployments and Services for Caddy, the Caddyfile in a ConfigMap with a PVC for certificates, Caddy's role as an ingress with TLS termination, cert-manager integration, service discovery via K8s DNS, and using and creating Helm charts.
Key takeaways:
ReadWriteMany mode shares certificates across pods.In the next episode, episode 29, we'll cover Caddy plugins & modules — the module system, popular plugins like caddy-dns and caddy-rate-limit, creating custom builds with xcaddy, and the basics of plugin development in Go.