Search code examples
kubernetesapache-nifikong-ingress

Configuring kong ingress for apache-nifi api on minikube


I am trying to configure kong ingress controller for apache nifi.

About nifi:

Apache nifi instance is running on minikube, and it exposes a rest api that can be accessed with URLs:

http://ip:port/nifi-api/....

calls t /nifi-api work and results are returned as expected.

Service name for nifi instance in its yaml is 'nifi'.

For kong:

Installed kong on minikube, following this. I can see kong resources created.

enter image description here

For creating ingress to put nifi api behind kong, following this.

My ingress yaml:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nifi-api-routing
  annotations:
    konghq.com/strip-path: 'true'
spec:
  ingressClassName: kong
  rules:
  - host: kong.example
    http:
      paths:
      - path: /nifi-api
        pathType: ImplementationSpecific
        backend:
          service:
            name: nifi
            port:
              number: 30026

backend.service.name and backend.service.port are from service yaml for nifi. path is '/nifi-api' as nifi exposes its endpoints at it. host name 'kong.example' is same as one used in link.

My question is what all this means to client. If I call:

http://kong.example/nifi-api/...

It doesn't work. Browser cant reach the site.

curl -i $PROXY_IP still says 'no route matched with those values'.


Solution

  • Your issue should not be related to Kubernetes/Minikube but to the missing route to connect your host (kong.example).

    To fix it, first, delete the ingress:

    kubectl delete ingress nifi-api-routing
    

    enable ingress on minikube:

    minikube addons enable ingress
    

    get the minikube ip:

    minikube ip
    > 192.168.x.x
    

    and use it to add a new line into the file /etc/hosts to create the route:

    192.168.x.x kong.example
    

    finally, re-create your ingress with:

    kubectl apply -f ingressyaml
    

    If you search the ingress with kubectl get ingress, you should see something like:

    NAME             CLASS   HOSTS          ADDRESS       PORTS   AGE
    nifi-api-routing nginx   kong.example   192.168.x.x   80      5m
    

    Now, you can try to browse host with curl http://kong.example/echo.