Guide 01 · Namespace guardrails

Make ML-KEM the only way in.

Use Kubernetes admission policy to require a strict Traefik TLSOption on every Ingress in a namespace. The proxy enforces cryptography; the policy prevents teams from bypassing that configuration.

Check the prerequisites

This example uses production as the target namespace. Replace the namespace and hostnames with your own values.

  • Kubernetes 1.30+ with ValidatingAdmissionPolicy enabled
  • Traefik with the Kubernetes CRD provider and TLSOption support
  • A Traefik build whose Go TLS library recognizes X25519MLKEM768
  • Permission to manage cluster-scoped admission policies

Create the ML-KEM-only TLSOption

A single hybrid group and TLS 1.3 minimum make classical-only and TLS 1.2 handshakes fail at the Traefik termination point.

mlkem-tlsoption.yaml
yaml
apiVersion: traefik.io/v1alpha1
kind: TLSOption
metadata:
  name: mlkem-only
  namespace: production
spec:
  minVersion: VersionTLS13
  maxVersion: VersionTLS13
  curvePreferences:
    - X25519MLKEM768

Deny Ingresses that bypass the policy

The cluster-scoped policy checks the Traefik annotation. The binding limits Deny enforcement to the production namespace through its built-in namespace label.

require-mlkem-traefik.yaml
yaml
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicy
metadata:
  name: require-mlkem-traefik
spec:
  failurePolicy: Fail
  matchConstraints:
    resourceRules:
      - apiGroups: ["networking.k8s.io"]
        apiVersions: ["v1"]
        operations: ["CREATE", "UPDATE"]
        resources: ["ingresses"]
  validations:
    - expression: >-
        has(object.metadata.annotations) &&
        'traefik.ingress.kubernetes.io/router.tls.options' in object.metadata.annotations &&
        object.metadata.annotations['traefik.ingress.kubernetes.io/router.tls.options'] ==
        'production-mlkem-only@kubernetescrd'
      message: >-
        ML-KEM is required. Set the Traefik TLS options annotation to
        production-mlkem-only@kubernetescrd.
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicyBinding
metadata:
  name: require-mlkem-traefik-production
spec:
  policyName: require-mlkem-traefik
  validationActions: [Deny]
  matchResources:
    namespaceSelector:
      matchLabels:
        kubernetes.io/metadata.name: production

Reference the policy from each Ingress

The annotation value combines the TLSOption namespace and name, followed by the kubernetescrd provider suffix.

secure-app-ingress.yaml
yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: secure-app
  namespace: production
  annotations:
    traefik.ingress.kubernetes.io/router.tls.options: production-mlkem-only@kubernetescrd
spec:
  ingressClassName: traefik
  rules:
    - host: app.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: secure-app
                port:
                  number: 8080
  tls:
    - hosts: [app.example.com]
      secretName: secure-app-tls
Apply the example
shell
kubectl apply -f mlkem-tlsoption.yaml
kubectl apply -f require-mlkem-traefik.yaml
kubectl apply -f secure-app-ingress.yaml

Test the guardrail before relying on it

Try an Ingress without the required annotation. The API server should deny it before Traefik ever sees the object.

Expected admission failure
shell
kubectl apply -f insecure-ingress.yaml
# Expected: ValidatingAdmissionPolicy denies the request with:
# "ML-KEM is required. Set the Traefik TLS options annotation..."
Controlled rollback
shell
# Remove the binding to stop enforcement in production.
kubectl delete validatingadmissionpolicybinding require-mlkem-traefik-production

# Keep the policy and TLSOption for a later, controlled re-enable.