The ACME client must be installed and an account registered with acme-proxy before running any commands in this guide. See ACME clients page for installation instructions and systemd renewal timer setup.
Port 80 must be reachable from the acme-proxy server (used for HTTP-01 challenge validation).
Your domain’s DNS must resolve to the host where the ACME client runs.
Replace the following placeholders throughout this guide:
acme-proxy.example.com — your acme-proxy hostname
myserver.example.com — the domain you want a certificate for
Standalone mode runs a temporary HTTP server on port 80 to answer the ACME challenge. Use this when there is no existing web server — typical for backend services such as Databases, Redis, Kafka, etc.
Important Port 80 must be temporarily available on the host. If IPtables or network firewall is in place, they must allow incoming http traffic from acme-proxy to the host. See Connectivity Requirements
4. Docker and Docker Compose
This section covers the pattern for services already running as Docker containers or Docker Compose stacks. The ACME client runs on the host — not inside a container. Certificates are stored on the host filesystem and projected into running containers as read-only volume mounts. After renewal, the host-side renewal hook signals the affected containers to reload or restart.
The HTTP-01 challenge requires port 80 to be reachable. If a container already binds port 80 on the host, standalone mode cannot be used directly. Two approaches:
Option A — stop the container briefly (standalone mode):
Use pre- and post-hooks to stop the container before the challenge and restart it after. This causes a brief downtime window and is suitable for backend services where a short gap is acceptable.
Option B — webroot via a shared bind mount:
Mount a host directory (e.g., /var/www/acme-challenge) into the container at the path it serves for HTTP. The ACME client writes challenge files to that host directory; the container serves them. No downtime required. Use this when continuous availability on port 80 is required.
The examples below use Option A (standalone) for simplicity. Substitute webroot flags if you need Option B.
Step 1 — Issue the initial certificate on the host
Use any of the client commands from the Standalone Mode section, substituting a --reloadcmd / deploy hook that operates on Docker instead of systemd. For example, with acme.sh:
# Stop the container so port 80 is free for the challengedocker compose -f /path/to/docker-compose.yml stop myapp
acme.sh --issue \
--server https://acme-proxy.example.com/acme/acme/directory \
--standalone \
-d myserver.example.com
# Start the container againdocker compose -f /path/to/docker-compose.yml start myapp
Configure your application to load the TLS certificate from /etc/ssl/app/ inside the container. The exact configuration depends on the application.
Step 3 — Auto-renewal with container reload hook
After each renewal, the certificate files on the host are updated. The container must either reload its TLS configuration or restart to pick them up. Configure the appropriate hook for each ACME client.
5. Kubernetes (cert-manager)
cert-manager is a Kubernetes-native certificate controller that speaks ACME natively. It handles account registration, order submission, challenge validation, and automatic renewal without any per-host tooling.
How HTTP-01 works with cert-manager:
cert-manager creates a temporary solver Pod and an HTTPRoute for /.well-known/acme-challenge/<token> attached to your Gateway
acme-proxy makes an HTTP request to http://<domain>/.well-known/acme-challenge/<token> to validate domain ownership
On success, cert-manager submits the CSR and retrieves the signed certificate
The certificate is stored in a Kubernetes Secret and renewed automatically before expiry
Network requirement: acme-proxy must be able to reach port 80 on the cluster’s Gateway. The domain must resolve to the Gateway’s external IP.
cert-manager Prerequisites
cert-manager v1.15+ — Gateway API support is enabled by default; earlier versions require --feature-gates=ExperimentalGatewayAPISupport=true
Gateway API CRDs installed (gateway.networking.k8s.io/v1)
A conformant Gateway implementation deployed (examples use nginx as the gatewayClassName; any v1-conformant implementation works)
acme-proxy reachable from cert-manager pods on port 443 (for account registration and order submission)
Port 80 of the Gateway reachable from acme-proxy (for HTTP-01 challenge validation)
Step 1 — Create a Gateway
The Gateway must have an HTTP listener on port 80 to serve ACME challenges. cert-manager creates HTTPRoute objects in the same namespace as the Certificate (not the cert-manager namespace), so allowedRoutes.namespaces.from: All is required on the HTTP listener unless you restrict it to the specific namespaces where certificates are issued.
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: my-gateway
namespace: infra
annotations:
cert-manager.io/cluster-issuer: acme-proxy
spec:
gatewayClassName: nginx
listeners:
- name: http
port: 80protocol: HTTP
allowedRoutes:
namespaces:
from: All # cert-manager HTTPRoutes can originate from any namespace - name: https
port: 443protocol: HTTPS
tls:
mode: Terminate
certificateRefs:
- name: myserver-tls
namespace: infra
allowedRoutes:
namespaces:
from: Same
Step 2 — Create a ClusterIssuer
The gatewayHTTPRoute solver tells cert-manager which Gateway to attach challenge HTTPRoutes to.
kubectl apply -f clusterissuer.yaml
kubectl get clusterissuer acme-proxy
Expected output:
NAME READY AGE
acme-proxy True 30s
If READY is False, inspect the status conditions:
kubectl describe clusterissuer acme-proxy
A False state at this stage means account registration failed — check that acme-proxy is reachable from cert-manager pods and that the ACME directory URL is correct.
Do not delete the acme-proxy-account-key Secret. It contains the private key for the registered ACME account. Deleting it forces re-registration and may orphan any in-flight orders.
Step 3 — Issue a Certificate
Two approaches are supported depending on your workload type.
Option A — Gateway annotation (web workloads)
Add cert-manager.io/cluster-issuer to the Gateway. cert-manager detects the annotation and automatically creates a Certificate for each HTTPS listener that has a hostname set, storing the result in the listener’s certificateRefs Secret.
Option B — Certificate resource (non-HTTP workloads)
Use this for workloads that consume TLS directly — gRPC services, databases, message brokers. cert-manager uses the Gateway to serve the HTTP-01 challenge but delivers the certificate into an arbitrary Secret.
If the certificate stays in False or Issuing state, follow the cert-manager object chain — each level narrows down where the failure occurred:
kubectl describe certificate myserver-tls -n default
kubectl get certificaterequest -n default
kubectl describe certificaterequest <name> -n default
kubectl get order -n default
kubectl describe order <name> -n default
kubectl get challenge -n default
kubectl describe challenge <name> -n default
The Challenge object’s status message identifies the exact failure:
Symptom
Likely cause
ClusterIssuer not ready
acme-proxy unreachable from cert-manager pods; wrong ACME directory URL
Challenge stays pending
acme-proxy cannot reach the Gateway on port 80; domain DNS not pointing at the Gateway’s external IP
Challenge HTTPRoute not attached
Gateway HTTP listener allowedRoutes does not include the namespace where the Certificate lives
Challenge fails with connection refused
HTTP listener missing on Gateway, or parentRefs in ClusterIssuer pointing to wrong Gateway name or namespace
unauthorized from ACME server
The acme-proxy-account-key Secret was deleted; recreate the ClusterIssuer to re-register
Pre and Post Hooks
Hooks let you run shell commands at specific points in the certificate lifecycle. The primary use cases are:
Freeing port 80 — standalone mode requires port 80 for the HTTP-01 challenge. If another process occupies it, use a pre-hook to stop it and a post-hook to restart it.
Reloading services after renewal — so the renewed certificate is picked up without a full service restart.
The three clients use different hook mechanisms.
Hook phases
Phase
When it runs
Purpose
Pre-hook
Before the challenge attempt
Free port 80, drain connections
Post-hook
After the challenge, regardless of outcome
Restore services stopped by pre-hook
Deploy / renew hook
Only on successful issuance or renewal
Reload or restart the service using the certificate
Troubleshooting
Symptom
Likely cause
Fix
connection refused on port 80
Firewall blocking challenge traffic
Open port 80 from acme-proxy host
no route to host to acme-proxy
DNS not resolving or network ACL
Confirm the proxy hostname resolves and port 443 is reachable
Certificate issued but service won’t reload
--reloadcmd / deploy hook misconfigured
Run the reload command manually; check service name
Renewal fails in standalone mode
Port 80 occupied during renewal window
Stop the process holding port 80 before renewal, or switch to webroot mode
unauthorized from ACME server
Account not registered with this server
Re-run --register-account against the correct --server URL