Connection between KONG and Apis in a kubernetes implementation?

  1. In a KONG Kubernetes implementation Is a recommendation to set load balancers (NGINXs) between Apis and Kong or this connection can be done with headless services ?

If you’re using Kong as an Ingress controller, Kong will act as your load balancer, meaning, it will take the endpoints or IP:Port of the pods belonging to a service and then route traffic to them.

1 Like

Kong will be a gateway for an api store so our question is when we are adding a service, see below the curl statement, in which sport-stats-service.default.svc.cluster.local is the address to a Headless service . Our questions is if it should be a Headless service or a Loadbalancer service? See url stream pointing to the api

curl -v -i -X POST
–url $(minikube service kong-admin --url)/services/
–data ‘name=football-service’
–data ‘url=http://sport-stats-service.default.svc.cluster.local:9000/apirest/premier’

Headless service:

apiVersion: v1
kind: Service
app: sport-stats
name: sport-stats-service
clusterIP: None
– port: 9000
app: sport-stats

Either way will work but lead to different behaviors as the DNS setup for a LoadBalancer and a Headless service is different.

If you use a Headless service, Kong will resolve the DNS and do round robin load balancing on all the pods, while if you use a Loadbalancer service, Kong will proxy the requests to kube-proxy, which will then load balance your traffic.