caddy
by alekc
Extensible, cross-platform Caddy web server with automatic HTTPS, deployed here as a lightweight reverse proxy with Renovate-tracked upstream releases.
About this chart
caddy
Extensible, cross-platform Caddy web server with automatic HTTPS, deployed here as a lightweight reverse proxy with Renovate-tracked upstream releases.
Caddy is a general-purpose web server that serves static files, reverse-proxies to backend
services, and provisions TLS certificates automatically. This chart wraps the upstream image
with a minimal Kubernetes Deployment, Service, and optional Ingress/HPA, and a Caddyfile
assembled from values.yaml. appVersion and this chart's own version are bumped together
by Renovate on every upstream release, so a deployed caddy release is never running a stale
image without the chart itself also having moved.
Quick start
From the classic chart repository:
helm repo add alekc https://charts.alekc.dev
helm repo update
helm install my-caddy alekc/caddy \
--set ingress.enabled=true \
--set ingress.hosts[0].host=caddy.example.com
Or directly from the OCI registry, no helm repo add needed:
helm install my-caddy oci://charts.alekc.dev/caddy --version 0.8.0
A minimal working values.yaml:
ingress:
enabled: true
hosts:
- host: caddy.example.com
paths:
- path: /
pathType: ImplementationSpecific
config:
caddyFile: |
{
handle / {
respond "Hello"
}
}
Verifying the signature
curl -sO https://charts.alekc.dev/pubring.gpg
helm pull oci://charts.alekc.dev/caddy --version 0.8.0 --verify --keyring pubring.gpg
Maintainers
| Name | Url | |
|---|---|---|
| alekc | [email protected] |
Source Code
Gotchas
config.caddyFileis raw Caddyfile text, appended verbatim afterconfig.global. There is no templating or validation of it beyondnindent, a syntax error in it only surfaces as a CrashLoopBackOff on the running container, checkkubectl logsfor Caddy's own parser error rather than assuming the chart failed to render.- The internal healthcheck listens on a fixed
:9999(health.port), separate from the mainlistenPort/https.port. It is wired into the container'slivenessProbebut never exposed through the Service or Ingress; changinghealth.portwithout also updatinghealth.path(or vice versa) breaks liveness silently until the pod is restarted and starts failing its probe. image.tagSuffix(default-alpine) is appended after whichever tag resolves, chartappVersionor an explicitimage.tagoverride. Settingimage.tagto a tag that already carries its own suffix (e.g.2.11.4-alpine) together with the defaulttagSuffixproduces a double-suffixed, non-existent tag; clearimage.tagSuffixto""in that case.- HPA and Ingress pick their API version from
.Capabilities.KubeVersion, not a hardcoded constant, so both already render correctly (autoscaling/v2,networking.k8s.io/v1) on any cluster this chart'svalues.schema.jsonand CI target (Kubernetes 1.34), no chart-side action needed on an upgrade. networkPolicy.enabledrestricts egress to DNS plus whateverextraEgressadds. Caddy commonly reverse-proxies to arbitrary backends, so enabling this without a realnetworkPolicy.extraEgressentry for each backend will silently break proxying, not fail loudly. Only enable it for a deployment with a small, known set of upstreams.metrics.serviceMonitor.enabledonly tells Prometheus where to scrape, it does not turn on Caddy's own metrics collection. Addmetricstoconfig.globaland ametrics /metricsdirective to a site block inconfig.caddyFilefirst (Caddy's built-in Prometheus endpoint needs no bearer token, unlike some other apps' metrics integrations).podDisruptionBudget.enabledis only meaningful oncereplicaCount(orautoscaling.minReplicas) is greater than 1. With a single replica, a PDB withminAvailable: 1blocks voluntary node draining entirely, since there is no second pod to take over first.
Upgrade notes
No breaking changes yet. This section will list migration steps for any future release with
a kind: removed or kind: changed entry in artifacthub.io/changes that requires one.
Values
| Key | Type | Default | Description |
|---|---|---|---|
| additionalManifests | object | {} | Additional raw Kubernetes manifests to render alongside the chart's own resources. Supports any valid Kubernetes object; values are templated with tpl, so a manifest can reference .Release.Namespace and friends. |
| affinity | object | {} | affinity rules for pod scheduling |
| autoscaling.annotations | object | {} | Annotations to add to the HorizontalPodAutoscaler |
| autoscaling.enabled | bool | false | enable a HorizontalPodAutoscaler for this Deployment |
| autoscaling.maxReplicas | int | 100 | maximum replica count |
| autoscaling.minReplicas | int | 1 | minimum replica count |
| autoscaling.targetCPUUtilizationPercentage | int | 80 | target average CPU utilization percentage |
| commonAnnotations | object | {} | Annotations merged onto every resource this chart renders, in addition to each resource's own dedicated .annotations field. |
| commonLabels | object | {} | Labels merged onto every resource this chart renders. Never reaches selector/matchLabels, safe to change without forcing a Deployment recreate. |
| config | object | {"caddyFile":"{\n handle / {\n respond \"Hello\"\n }\n}\n","debug":false,"global":"auto_https off\nacme_ca https://acme-staging-v02.api.letsencrypt.org/directory\nlog {\n output stdout\n}\n"} | Caddy configuration |
| config.caddyFile | string | "{\n handle / {\n respond \"Hello\"\n }\n}\n" | this is a place to add your own configuration. It will be appended after the global section |
| config.debug | bool | false | if true, it will enable debugging |
| config.global | string | "auto_https off\nacme_ca https://acme-staging-v02.api.letsencrypt.org/directory\nlog {\n output stdout\n}\n" | config going to a global section. See https://caddyserver.com/docs/caddyfile/options for reference |
| configMapAnnotations | object | {} | Annotations to add to the ConfigMap. |
| deploymentAnnotations | object | {} | Annotations to add to the Deployment. |
| extraContainers | list | [] | Extra sidecar containers appended to the pod spec, templated with tpl so they can reference .Release.Namespace and friends. |
| fullnameOverride | string | "" | override the full resource name, instead of the default <release>-<chart> pattern |
| gateway.annotations | object | {} | Annotations to add to the HTTPRoute |
| gateway.enabled | bool | false | Renders an HTTPRoute attached to an existing Gateway, instead of (or alongside) Ingress. Requires the Gateway API CRDs and a Gateway already provisioned elsewhere, this chart never creates the Gateway itself. |
| gateway.hostnames | list | [] | Hostnames this HTTPRoute matches. Leave empty to inherit the Gateway's own. |
| gateway.name | string | "" | Name of the existing Gateway to attach the HTTPRoute to. |
| gateway.namespace | string | "" | Namespace of the existing Gateway. Defaults to this release's namespace. |
| gateway.rules | list | [{"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}] | HTTPRoute rules, each needs at least matches, see the Gateway API spec. |
| gateway.sectionName | string | "" | Optional listener sectionName on the Gateway to bind to. |
| health.path | string | "/" | Health check path |
| health.port | int | 9999 | port the internal healthcheck server listens on |
| https | object | {"enabled":false,"port":443} | manage https |
| https.enabled | bool | false | enable https ports. If true, ingress will point to the https port and not http one |
| https.port | int | 443 | https port |
| image.pullPolicy | string | "IfNotPresent" | image pull policy |
| image.repository | string | "caddy" | image repository |
| image.tag | string | "" | overrides the image tag whose default is the chart appVersion |
| image.tagSuffix | string | "-alpine" | appended after the resolved tag (chart appVersion or image.tag override), e.g. "-alpine" |
| imagePullSecrets | list | [] | image pull secrets for private registries |
| ingress.annotations | object | {} | Annotations to add to the Ingress |
| ingress.className | string | "" | IngressClass name, e.g. "nginx" or "traefik" |
| ingress.enabled | bool | false | enable the Ingress resource |
| ingress.hosts | list | [{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}] | Ingress host and path rules |
| ingress.tls | list | [] | TLS configuration for the Ingress |
| initContainers | list | [] | Extra init containers appended to the pod spec, templated with tpl. |
| listenPort | int | 8080 | port caddy container and service is listening to |
| metrics.serviceMonitor.additionalLabels | object | {} | Additional labels merged onto the ServiceMonitor itself (for a Prometheus Operator serviceMonitorSelector). |
| metrics.serviceMonitor.annotations | object | {} | Annotations to add to the ServiceMonitor |
| metrics.serviceMonitor.enabled | bool | false | Renders a ServiceMonitor for the Prometheus Operator. Requires the monitoring.coreos.com CRDs, and Caddy's own metrics global option plus a metrics directive enabled in config, see Gotchas, this value only tells Prometheus where to scrape. |
| metrics.serviceMonitor.interval | string | "30s" | Scrape interval. |
| metrics.serviceMonitor.path | string | "/metrics" | Metrics path, matches Caddy's own metrics directive path. |
| nameOverride | string | "" | override the chart name used to build resource names |
| networkPolicy.annotations | object | {} | Annotations to add to the NetworkPolicy |
| networkPolicy.enabled | bool | false | Render a NetworkPolicy restricting ingress to the Service port and egress to DNS plus whatever extraEgress adds. Caddy commonly reverse- proxies to arbitrary backends, so most deployments need a real extraEgress entry once this is enabled, see Gotchas. |
| networkPolicy.extraEgress | list | [] | Additional raw egress rules, appended as-is under spec.egress. |
| networkPolicy.extraIngress | list | [] | Additional raw ingress rules, appended as-is under spec.ingress. |
| nodeSelector | object | {} | node selector for pod scheduling |
| persistence.accessMode | string | "ReadWriteOnce" | Access mode for the created PVC. |
| persistence.annotations | object | {} | Annotations to add to the PersistentVolumeClaim |
| persistence.enabled | bool | false | Render a PersistentVolumeClaim and mount it into the container, for static files, a TLS/cache directory, or similar. Off by default, this chart's own Caddyfile config already lives in a ConfigMap. |
| persistence.existingClaim | string | "" | Use an existing PVC instead of creating one. When set, enabled still gates whether the volume is mounted, but no PVC is created here. |
| persistence.mountPath | string | "/data" | Path inside the container to mount the volume at. |
| persistence.size | string | "1Gi" | Requested size for the created PVC. |
| persistence.storageClass | string | "" | StorageClass for the created PVC. Empty uses the cluster default. |
| podAnnotations | object | {} | Annotations to add to the Pod. |
| podDisruptionBudget.annotations | object | {} | Annotations to add to the PodDisruptionBudget |
| podDisruptionBudget.enabled | bool | false | Render a PodDisruptionBudget. Only meaningful once replicaCount (or autoscaling.minReplicas) is greater than 1, see Gotchas. |
| podDisruptionBudget.maxUnavailable | string | "" | Maximum unavailable pods during a voluntary disruption. |
| podDisruptionBudget.minAvailable | string | "" | Minimum available pods during a voluntary disruption. Mutually exclusive with maxUnavailable. |
| podSecurityContext | object | {} | security context applied at the pod level |
| replicaCount | int | 1 | number of pod replicas. Ignored when autoscaling.enabled is true |
| resources | object | {"requests":{"cpu":"32m","memory":"64Mi"}} | container resource requests/limits |
| securityContext | object | {} | security context applied at the container level |
| service.annotations | object | {} | Annotations to add to the Service |
| service.externalTrafficPolicy | string | "Cluster" | External traffic policy. Used only when service.type is LoadBalancer or Nodeport |
| service.port | int | 80 | Service port, forwards to listenPort on the container |
| service.type | string | "ClusterIP" | Kubernetes Service type |
| serviceAccount.annotations | object | {} | Annotations to add to the service account |
| serviceAccount.create | bool | true | Specifies whether a service account should be created |
| serviceAccount.name | string | "" | If not set and create is true, a name is generated using the fullname template |
| tolerations | list | [] | tolerations for pod scheduling |
| volumeMounts | list | [] | define additional volumeMounts |
| volumes | list | [] | define additional volumes |
Deploy caddy with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has caddy on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartcaddy is pinned at v0.9.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply