I’m considering a use case where kong is deployed outside the kubernetes cluster. Now the ingress controller can add routes and services in Kong. However, it cannot find the correct upstream endpoints. In https://github.com/Kong/kubernetes-ingress-controller/blob/master/internal/ingress/controller/endpoints.go#L31 the endpoints are just IP addresses of the pods.
When the Kong service is outside the kubernetes cluster, it cannot reach the endpoints using pod IPs. I have an idea for this case:
- The service can have type NodePort. This opens a port 3xxxx on each node of the kubernetes cluster.
- For the endpoint list, we use : where IP is the node IP, and port is the 3xxxx port.
This deployment may sound weird. It’s useful in a few cases. I have a few examples:
- While the kubernetes cluster is using IPv4, and the services should be reached by IPv6 clients. In this case, we can run Kong in an IPv4/IPv6 dual stack server outside the kubernetes cluster, and ask the ingress controller to set up the routes.
- While the kubernetes cluster does not have LoadBalancer available, and the service is required to work on a fixed port. We may consider deploying an external API gateway.