Kubernetes Ingress でパスのリライトをする

2024-01-01 13:50 (4ヶ月前) ytyng

rules.http.paths.path で正規表現でマッチさせたものが metadata.annotations.nginx.ingress.kubernetes.io/rewrite-target に入ります。

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-ingress
  namespace: my-namespace
  annotations:
    ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /api/apppath/$1
spec:
  tls:
    - secretName: my-http-cert
  rules:
    - host: log.ytyng.com
      http:
        paths:
          - path: /(.*)
            pathType: Prefix
            backend:
              service:
                name: my-service-service
                port:
                  number: 8000
Currently unrated

Comments

Archive

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011