K8S - KongIngress - Redirect HTTP to HTTPS

Hi all!

I’m using service kong(v1.3) and Ingress(0.6.0) in K8S and I need creating the redirect HTTP to HTTPS. I’m trying this setup below, but not functionaly:

apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
  name: nginx-http-to-https
  namespace: nginx
route:
  protocols:
  - https
  https_redirect_status_code: 302

All requests HTTP and HTTPS for my application thats OK (return 200 OK), but I need the redirect.

The log of the service:

E1129 19:11:47.191620 1 controller.go:132] unexpected failure updating Kong configuration:
2 errors occurred:
Preformatted text	while processing event: {Create} failed: 409 Conflict {"message":"UNIQUE violation detected on '{name=\"nginx.nginx-svc.80\"}'","name":"unique constraint violation","fields":{"name":"nginx.nginx-svc.80"},"code":5}
	could not find service 'nginx.nginx-svc.80' for route nginx.nginx-ingress.00: entity not found
W1129 19:11:47.191649       1 queue.go:113] requeuing nginx/nginx-ingress, err 2 errors occurred:
	while processing event: {Create} failed: 409 Conflict {"message":"UNIQUE violation detected on '{name=\"nginx.nginx-svc.80\"}'","name":"unique constraint violation","fields":{"name":"nginx.nginx-svc.80"},"code":5}
	could not find service 'nginx.nginx-svc.80' for route nginx.nginx-ingress.00: entity not found

Seems like you have two ports on the Nginx service that need to be exposed.
The controller doesn’t support multi-port services yet as of 0.6, but the PR for it has been merged:https://github.com/Kong/kubernetes-ingress-controller/pull/404


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ