Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
Gateway API (new clusters, with a controller such as Envoy Gateway installed):
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: shop
namespace: shop
spec:
parentRefs:
- name: public-gw
namespace: gateway
hostnames: ["shop.example.com"]
rules:
- backendRefs:
- name: frontend
port: 80Step by step
- Check what the cluster has — a controller is needed, the YAML alone does nothing:
- Gateway API — the platform team's Gateway (listeners and TLS), shared by many apps:
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: public-gw
namespace: gateway
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
gatewayClassName: eg
listeners:
- name: https-shop
protocol: HTTPS
port: 443
hostname: shop.example.com
tls:
certificateRefs:
- name: shop-tls
allowedRoutes:
namespaces: { from: All }cert-manager sees the annotation and creates the shop-tls certificate (its Gateway API support must be enabled). The app team only writes the HTTPRoute (quick answer).
- Ingress — the classic way (clusters with a maintained Ingress controller, for example Traefik):
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
namespace: shop
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: traefik
tls:
- hosts: ["shop.example.com"]
secretName: shop-tls
rules:
- host: shop.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: frontend
port:
number: 80- DNS — point
shop.example.comto the load balancer of the Gateway/Ingress controller:
- Watch the certificate:
READY True = issued; otherwise the events show the ACME challenge step that fails.
Check that it worked
curl -sI https://shop.example.com returns 200/301 with a valid certificate (issuer Let's Encrypt), and kubectl get certificate shows READY True with a renewal date.
Common problems
| Problem | Cause | Fix |
|---|---|---|
Nothing happens after apply | No controller for that class. | kubectl get gatewayclass/ingressclass; install a controller; set the right class name. |
404 from the controller | Host or path does not match. | Check hostnames/host and the path type; test with curl -H 'Host: …'. |
503 / no endpoints | Service name/port wrong, or Pods not ready. | kubectl get endpoints frontend -n shop. |
Certificate stays READY False | DNS not pointing to the controller, port 80 blocked, wrong issuer. | kubectl describe certificate/order/challenge; fix DNS. |
| HTTPRoute not attached | Gateway's allowedRoutes does not allow the namespace. | Allow it, or reference the right listener. |
| Still on ingress-nginx | Retired, no security fixes since March 2026. | Plan the move to Gateway API (see the full guide). |
Go further
- Command pages: kubectl, curl, dig.
- Next how-tos: Get a free TLS certificate with Let's Encrypt, Add liveness and readiness probes, Check when a TLS certificate expires.
- Full guides: ingress-nginx (retired) and Gateway API, cert-manager, Traefik.
- Learn it: CKA — Ingress, CKA — Gateway API, CKA — TLS.
1Why should a new cluster not use ingress-nginx?
It was retired; maintenance and security fixes ended in March 2026 — use the Gateway API or another maintained controller.
2What makes cert-manager create a certificate for an Ingress or Gateway?
The annotation cert-manager.io/cluster-issuer: NAME plus the TLS secret name in the object.