1

I want to use a snippet in Kong. I need to add some specific rule into ingress.

The best thing I found was a snippet in Nginx so I use Nginx snippet in Kong ingress like this:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
    name: test
    namespace: test
    annotations:
    kubernetes.io/tls-acme: "true"
    cert-manager.io/cluster-issuer: letsencrypt-pro-dns
    konghq.com/protocols: https
    konghq.com/https-redirect-status-code: "301"
    kubernetes.io/ingress.class: kong
    konghq.com/configuration-snippet: |
        location /test {
        return 404;
        }
spec:
    tls:
    - secretName: test-com
    hosts:
    - '*.example.com'
    - example.com
    rules:
    - host: test.example.com
    http:
        paths:
        - backend:
            service:
            name: test
            port:
                number: 8080
        path: /
        pathType: Prefix

It didn't work, how can I use snippet or something like that in Kong ingress?

Mikolaj S.
  • 2,850
  • 1
  • 5
  • 17

0 Answers0