caddy

by alekc

Helm chartv0.9.4App 2.11.9Apache-2.0Verified publisher

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

NameEmailUrl
alekc[email protected]

Source Code

Gotchas

  • config.caddyFile is raw Caddyfile text, appended verbatim after config.global. There is no templating or validation of it beyond nindent, a syntax error in it only surfaces as a CrashLoopBackOff on the running container, check kubectl logs for 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 main listenPort/https.port. It is wired into the container's livenessProbe but never exposed through the Service or Ingress; changing health.port without also updating health.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, chart appVersion or an explicit image.tag override. Setting image.tag to a tag that already carries its own suffix (e.g. 2.11.4-alpine) together with the default tagSuffix produces a double-suffixed, non-existent tag; clear image.tagSuffix to "" 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's values.schema.json and CI target (Kubernetes 1.34), no chart-side action needed on an upgrade.
  • networkPolicy.enabled restricts egress to DNS plus whatever extraEgress adds. Caddy commonly reverse-proxies to arbitrary backends, so enabling this without a real networkPolicy.extraEgress entry 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.enabled only tells Prometheus where to scrape, it does not turn on Caddy's own metrics collection. Add metrics to config.global and a metrics /metrics directive to a site block in config.caddyFile first (Caddy's built-in Prometheus endpoint needs no bearer token, unlike some other apps' metrics integrations).
  • podDisruptionBudget.enabled is only meaningful once replicaCount (or autoscaling.minReplicas) is greater than 1. With a single replica, a PDB with minAvailable: 1 blocks 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

KeyTypeDefaultDescription
additionalManifestsobject{}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.
affinityobject{}affinity rules for pod scheduling
autoscaling.annotationsobject{}Annotations to add to the HorizontalPodAutoscaler
autoscaling.enabledboolfalseenable a HorizontalPodAutoscaler for this Deployment
autoscaling.maxReplicasint100maximum replica count
autoscaling.minReplicasint1minimum replica count
autoscaling.targetCPUUtilizationPercentageint80target average CPU utilization percentage
commonAnnotationsobject{}Annotations merged onto every resource this chart renders, in addition to each resource's own dedicated .annotations field.
commonLabelsobject{}Labels merged onto every resource this chart renders. Never reaches selector/matchLabels, safe to change without forcing a Deployment recreate.
configobject{"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.caddyFilestring"{\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.debugboolfalseif true, it will enable debugging
config.globalstring"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
configMapAnnotationsobject{}Annotations to add to the ConfigMap.
deploymentAnnotationsobject{}Annotations to add to the Deployment.
extraContainerslist[]Extra sidecar containers appended to the pod spec, templated with tpl so they can reference .Release.Namespace and friends.
fullnameOverridestring""override the full resource name, instead of the default <release>-<chart> pattern
gateway.annotationsobject{}Annotations to add to the HTTPRoute
gateway.enabledboolfalseRenders 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.hostnameslist[]Hostnames this HTTPRoute matches. Leave empty to inherit the Gateway's own.
gateway.namestring""Name of the existing Gateway to attach the HTTPRoute to.
gateway.namespacestring""Namespace of the existing Gateway. Defaults to this release's namespace.
gateway.ruleslist[{"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]HTTPRoute rules, each needs at least matches, see the Gateway API spec.
gateway.sectionNamestring""Optional listener sectionName on the Gateway to bind to.
health.pathstring"/"Health check path
health.portint9999port the internal healthcheck server listens on
httpsobject{"enabled":false,"port":443}manage https
https.enabledboolfalseenable https ports. If true, ingress will point to the https port and not http one
https.portint443https port
image.pullPolicystring"IfNotPresent"image pull policy
image.repositorystring"caddy"image repository
image.tagstring""overrides the image tag whose default is the chart appVersion
image.tagSuffixstring"-alpine"appended after the resolved tag (chart appVersion or image.tag override), e.g. "-alpine"
imagePullSecretslist[]image pull secrets for private registries
ingress.annotationsobject{}Annotations to add to the Ingress
ingress.classNamestring""IngressClass name, e.g. "nginx" or "traefik"
ingress.enabledboolfalseenable the Ingress resource
ingress.hostslist[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}]Ingress host and path rules
ingress.tlslist[]TLS configuration for the Ingress
initContainerslist[]Extra init containers appended to the pod spec, templated with tpl.
listenPortint8080port caddy container and service is listening to
metrics.serviceMonitor.additionalLabelsobject{}Additional labels merged onto the ServiceMonitor itself (for a Prometheus Operator serviceMonitorSelector).
metrics.serviceMonitor.annotationsobject{}Annotations to add to the ServiceMonitor
metrics.serviceMonitor.enabledboolfalseRenders 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.intervalstring"30s"Scrape interval.
metrics.serviceMonitor.pathstring"/metrics"Metrics path, matches Caddy's own metrics directive path.
nameOverridestring""override the chart name used to build resource names
networkPolicy.annotationsobject{}Annotations to add to the NetworkPolicy
networkPolicy.enabledboolfalseRender 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.extraEgresslist[]Additional raw egress rules, appended as-is under spec.egress.
networkPolicy.extraIngresslist[]Additional raw ingress rules, appended as-is under spec.ingress.
nodeSelectorobject{}node selector for pod scheduling
persistence.accessModestring"ReadWriteOnce"Access mode for the created PVC.
persistence.annotationsobject{}Annotations to add to the PersistentVolumeClaim
persistence.enabledboolfalseRender 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.existingClaimstring""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.mountPathstring"/data"Path inside the container to mount the volume at.
persistence.sizestring"1Gi"Requested size for the created PVC.
persistence.storageClassstring""StorageClass for the created PVC. Empty uses the cluster default.
podAnnotationsobject{}Annotations to add to the Pod.
podDisruptionBudget.annotationsobject{}Annotations to add to the PodDisruptionBudget
podDisruptionBudget.enabledboolfalseRender a PodDisruptionBudget. Only meaningful once replicaCount (or autoscaling.minReplicas) is greater than 1, see Gotchas.
podDisruptionBudget.maxUnavailablestring""Maximum unavailable pods during a voluntary disruption.
podDisruptionBudget.minAvailablestring""Minimum available pods during a voluntary disruption. Mutually exclusive with maxUnavailable.
podSecurityContextobject{}security context applied at the pod level
replicaCountint1number of pod replicas. Ignored when autoscaling.enabled is true
resourcesobject{"requests":{"cpu":"32m","memory":"64Mi"}}container resource requests/limits
securityContextobject{}security context applied at the container level
service.annotationsobject{}Annotations to add to the Service
service.externalTrafficPolicystring"Cluster"External traffic policy. Used only when service.type is LoadBalancer or Nodeport
service.portint80Service port, forwards to listenPort on the container
service.typestring"ClusterIP"Kubernetes Service type
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.createbooltrueSpecifies whether a service account should be created
serviceAccount.namestring""If not set and create is true, a name is generated using the fullname template
tolerationslist[]tolerations for pod scheduling
volumeMountslist[]define additional volumeMounts
volumeslist[]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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcaddy is pinned at v0.9.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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