Associate a KongIngress custom resource with an Ingress resource

Hi Kong friends

I am using kong-ingress-controller in order to redirect my incoming traffic to some URL service.

This is my ingress resource, with the following annotations:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kong-ingress-zcrm365
  annotations:
    kubernetes.io/ingress.class: "kong"
    certmanager.k8s.io/acme-challenge-type: http01
    kubernetes.io/tls-acme: "true"
    certmanager.k8s.io/acme-http01-edit-in-place: "true"
    certmanager.k8s.io/cluster-issuer: letsencrypt-prod # letsencrypt-staging
spec:
  rules:
  - host: test1kongletsencrypt.possibilit.nl
    http:
      paths:
        - path: "/"
          backend:
            serviceName: zcrm365dev
            servicePort: 80
  tls: 
  - hosts:
    - test1kongletsencrypt.possibilit.nl
    secretName: letsencrypt-prod # letsencrypt-staging

Currently, everything looks work well, my ingress resource works and looks if it was taking to kong-ingress-controller like ingress system:

⟩ kubectl describe ingress kong-ingress-zcrm365 

Annotations:
  certmanager.k8s.io/acme-http01-edit-in-place:      true
  certmanager.k8s.io/cluster-issuer:                 letsencrypt-prod
  kubectl.kubernetes.io/last-applied-configuration:  {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"certmanager.k8s.io/acme-challenge-type":"http01","certmanager.k8s.io/acme-http01-edit-in-place":"true","certmanager.k8s.io/cluster-issuer":"letsencrypt-prod","kubernetes.io/ingress.class":"kong","kubernetes.io/tls-acme":"true"},"name":"kong-ingress-zcrm365","namespace":"default"},"spec":{"rules":[{"host":"test1kongletsencrypt.possibilit.nl","http":{"paths":[{"backend":{"serviceName":"zcrm365dev","servicePort":80},"path":"/"}]}}],"tls":[{"hosts":["test1kongletsencrypt.possibilit.nl"],"secretName":"letsencrypt-prod"}]}}

  kubernetes.io/ingress.class:             kong
  kubernetes.io/tls-acme:                  true
  certmanager.k8s.io/acme-challenge-type:  http01
Events:                                    <none>

But when I check the logs of my kong-ingress-controller pod, I get this output:

I0321 13:38:18.111716       6 controller.go:128] syncing Ingress configuration...
E0321 13:38:18.112283       6 kong.go:1142] Unexpected response searching a Kong Certificate: Get http://localhost:8001/certificates/xxxxxxx: dial tcp 127.0.0.1:8001: connect: connection refused
E0321 13:38:18.112381       6 controller.go:131] unexpected failure updating Kong configuration: 
Get http://localhost:8001/certificates/xxxx: dial tcp 127.0.0.1:8001: connect: connection refused
W0321 13:38:18.112426       6 queue.go:113] requeuing kong/kong-ingress-controller, err Get http://localhost:8001/certificates/xxxxxx: dial tcp 127.0.0.1:8001: connect: connection refused
I0321 13:38:21.445027       6 controller.go:128] syncing Ingress configuration...
I0321 13:38:21.558617       6 kong.go:1075] cert: xxxxx
I0321 13:38:21.906269       6 kong.go:113] syncing global plugins
W0321 13:38:22.052754       6 kong.go:335] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
W0321 13:38:22.148100       6 kong.go:751] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
I0321 13:57:46.099361       6 controller.go:128] syncing Ingress configuration...
I0321 13:57:46.099376       6 event.go:218] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"kong-ingress-zcrm365", UID:"61cfae03-4bc6-11e9-a113-e27267a7d354", APIVersion:"extensions", ResourceVersion:"1737014", FieldPath:""}): type: 'Normal' reason: 'UPDATE' Ingress default/kong-ingress-zcrm365
I0321 13:57:47.109286       6 kong.go:1075] cert: 0xc00028d9a0
I0321 13:57:47.359356       6 kong.go:113] syncing global plugins
W0321 13:57:47.512055       6 kong.go:335] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
W0321 13:57:47.620555       6 kong.go:751] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
I0321 13:59:15.951895       6 controller.go:128] syncing Ingress configuration...
I0321 13:59:17.007628       6 kong.go:1075] cert: 0xc0002d9de0
I0321 13:59:17.278458       6 kong.go:113] syncing global plugins
W0321 13:59:17.409185       6 kong.go:335] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
W0321 13:59:17.501766       6 kong.go:751] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
I0321 13:59:19.285339       6 controller.go:128] syncing Ingress configuration...
I0321 13:59:19.309961       6 kong.go:1075] cert: 0xc000467aa0
I0321 13:59:19.435868       6 kong.go:113] syncing global plugins
W0321 13:59:19.440702       6 kong.go:335] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
W0321 13:59:19.469779       6 kong.go:751] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
I0321 14:01:56.639413       6 controller.go:128] syncing Ingress configuration...
I0321 14:01:57.721909       6 kong.go:1075] cert: 0xc0004149d0
I0321 14:01:58.075285       6 kong.go:113] syncing global plugins
W0321 14:01:58.411690       6 kong.go:335] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
W0321 14:01:58.502241       6 kong.go:751] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
I0321 14:02:05.631933       6 controller.go:128] syncing Ingress configuration...
I0321 14:02:10.656147       6 kong.go:1075] cert: 0xc0002d9f40
I0321 14:02:11.404879       6 kong.go:113] syncing global plugins
W0321 14:02:11.636497       6 kong.go:335] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
W0321 14:02:11.730037       6 kong.go:751] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
I0321 14:04:06.613439       6 controller.go:128] syncing Ingress configuration...
I0321 14:04:07.724478       6 kong.go:1075] cert: 0xc000247f00
I0321 14:04:08.020591       6 kong.go:113] syncing global plugins
W0321 14:04:08.220507       6 kong.go:335] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
W0321 14:04:08.321211       6 kong.go:751] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
I0321 14:04:15.613841       6 controller.go:128] syncing Ingress configuration...
I0321 14:04:16.638482       6 kong.go:1075] cert: 0xc000047b50
I0321 14:04:16.901985       6 kong.go:113] syncing global plugins
W0321 14:04:17.070157       6 kong.go:335] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
W0321 14:04:17.153808       6 kong.go:751] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
I0321 14:09:15.952353       6 controller.go:128] syncing Ingress configuration...
I0321 14:09:16.699389       6 kong.go:1075] cert: 0xc000247d90
I0321 14:09:18.207881       6 kong.go:113] syncing global plugins
W0321 14:09:18.930252       6 kong.go:335] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
W0321 14:09:19.014756       6 kong.go:751] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
I0321 14:09:19.285693       6 controller.go:128] syncing Ingress configuration...
I0321 14:09:19.313476       6 kong.go:1075] cert: 0xc0002d99f0
I0321 14:09:19.443502       6 kong.go:113] syncing global plugins
W0321 14:09:19.448412       6 kong.go:335] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365
W0321 14:09:19.477150       6 kong.go:751] there is no custom Ingress configuration for rule default/kong-ingress-zcrm365

I am not sure why happens this, I am thinking, that probably do I need to associate a KongIngress with my kong-ingress-zcrm365 Ingress resource to set it up correctly?

I’ve been exploring. And I’ve created this KongIngress resource to associate it to my ingress

apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
  name: external-ingress
  namespace: testing
proxy:
  path: /
route:
  protocols:
  - https
  strip_path: false
  preserve_host: true

But I get this error:

error: error validating "mykongingress.yaml": error validating data: [ValidationError(Ingress):
 unknown field "proxy" in io.k8s.api.extensions.v1beta1.Ingress, ValidationError(Ingress):
 unknown field "route" in io.k8s.api.extensions.v1beta1.Ingress]; if you choose to ignore these
 errors, turn validation off with --validate=false

How to can I define a KongIngress resource well?

I had a misconfiguration on my .yaml file. Finally, my KongIngress resource has stayed of this way:

apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
  name: kong-ingress-config
  # namespace: default
proxy:
  protocols:
  - http
  - https
  path: /
route:
  methods:
  - POST
  - GET
  strip_path: false
  preserve_host: true

And the logs of my kong-ingress-controller pod are O.K.

⟩ kubectl logs pod/kong-ingress-controller-7b6d8fff97-dqhqx -n kong  -c ingress-controller

Updating Kong Route for host test1kongletsencrypt.possibilit.nl, path / and service 0xc0007d88a0
I0325 12:38:19.959492       6 controller.go:128] syncing Ingress configuration...
I0325 12:38:21.525801       6 kong.go:1075] cert: 0xc00054dbd0
I0325 12:38:21.803550       6 kong.go:113] syncing global plugins
I0325 12:38:25.620494       6 controller.go:128] syncing Ingress configuration...
I0325 12:38:25.775267       6 kong.go:1075] cert: 0xc0007d98f0
I0325 12:38:26.055921       6 kong.go:113] syncing global plugins
1 Like