13.11.2025 | Marc Hitscherich

Simple domain redirect in Kubernetes with nginx ingress

redirect-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: old-domain-redirect
  namespace: my-namespace
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
    nginx.ingress.kubernetes.io/permanent-redirect: https://new-domain.com$request_uri
    nginx.ingress.kubernetes.io/ssl-redirect: 'true'
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: old-domain.com
  tls:
  - hosts:
    - old-domain.com
    secretName: old-domain.com-cert

Issue:

You want to establish a redirect from an old domain of a client to their new domain but the certificate should remain the same, supporting all URI arguments

Prerequisites:

This only works for kubernetes / K8S and nginx ingress based infrastructure environments.

Solution:

Use the snippet provided.