I want to convert this to kong ingress, what needs to be changed?

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/cors-allow-headers: "*"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
  name: test
  namespace: admin
spec:
  ingressClassName: kong-dmz
  rules:
  - host: admin-stg.europe.com
    http:
      paths:
      - backend:
          service:
            name: admin-app-service
            port:
              number: 80
        path: /login
        pathType: Prefix
      - backend:
          service:
            name: admin-app-service
            port:
              number: 80
        path: /_test/
        pathType: Prefix
      - backend:
          service:
            name: admin-app-service
            port:
              number: 80
        path: /
        pathType: Prefix
  tls:
  - hosts:
    - admin-stg.europe.com
    secretName: ssl-europe-com


Converted:

I added these annotations, is this correct?

konghq.com/preserve-host: "true"

konghq.com/strip-path: "false"

konghq.com/plugins: cors-global # i created the plugin

konghq.com/protocols: "http,https"

konghq.com/https-redirect-status-code: "308"

@Efty I passed your question through our documentation agent (developer.konghq.com), please take a look and see if this addresses your question.


Good start! Here’s a review of your conversion from NGINX Ingress annotations to Kong Ingress Controller annotations:

What you got right :white_check_mark:

  • konghq.com/preserve-host: "true" — correct replacement for NGINX’s default host preservation behavior.
  • konghq.com/strip-path: "false" — valid annotation, though "false" is the default behavior. [strip-path annotation]
  • konghq.com/plugins: cors-global — correct way to attach a KongPlugin resource for CORS. [plugins annotation]
  • konghq.com/https-redirect-status-code: "308" — valid value (acceptable values are 301, 302, 307, 308, 426). [https-redirect-status-code]

What needs fixing :warning:

1. SSL redirect protocol

The NGINX annotation nginx.ingress.kubernetes.io/ssl-redirect: "true" forces HTTPS-only traffic. In Kong, this is done by setting:

konghq.com/protocols: "https"

Setting konghq.com/protocols: "http,https" allows both HTTP and HTTPS, which does not enforce a redirect. To actually redirect HTTP to HTTPS (like the NGINX annotation does), you need "https" only. [configure HTTPS redirect]

2. CORS headers annotation

The NGINX annotation nginx.ingress.kubernetes.io/cors-allow-headers: "*" configures CORS at the ingress controller level. In Kong, CORS is handled entirely by the CORS KongPlugin resource you create — the plugin’s config (e.g., headers, origins, methods) is where you set those values. There is no direct annotation equivalent for CORS header configuration. Make sure your cors-global KongPlugin resource has the correct config fields set.

Corrected annotation block

metadata:
  annotations:
    kubernetes.io/ingress.class: kong-dmz   # or use ingressClassName in spec (you already have it)
    konghq.com/protocols: "https"           # enforces HTTPS redirect
    konghq.com/https-redirect-status-code: "308"
    konghq.com/preserve-host: "true"
    konghq.com/strip-path: "false"
    konghq.com/plugins: cors-global

Note: Since you’re already using ingressClassName: kong-dmz in the spec, the kubernetes.io/ingress.class annotation may be redundant, but it’s worth keeping for compatibility depending on your KIC version. [ingress class annotation]