Kubernetes redirect on pod with python

1/31/2022

I have ingress with redirect:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    certmanager.k8s.io/cluster-issuer: letsencrypt-prod
    ingress.kubernetes.io/ssl-redirect: "true"
    meta.helm.sh/release-name: DOMAIN
    meta.helm.sh/release-namespace: DOMAIN
    nginx.ingress.kubernetes.io/configuration-snippet: |
      location ~ ^/online-web {
        return 301 /online;
      }
      if ($host = 'DOMAIN-alias.cz') {
        return 301 https://DOMAIN.cz;
      }
      if ($host ~ ^(.+)\.DOMAIN-alias\.cz$) {
        return 301 https://$1.DOMAIN.cz$request_uri;
      }
      if ($host = 'DOMAIN-alias-2.cz') {
        return 301 https://DOMAIN.cz;
      }

But when the certificate is renewed, the process crashes. Problem is with the annotation in the yaml.

I want to create a POD with redirect, How to please? Python?

Thanks

-- Robert Ohlídal
kubernetes
redirect

0 Answers