Connection between KONG and Apis in a kubernetes implementation?

#1
  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 ?
0 Likes

#2

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

#3

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
metadata:
labels:
app: sport-stats
name: sport-stats-service
spec:
clusterIP: None
ports:
– port: 9000
selector:
app: sport-stats

0 Likes

#4

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.

0 Likes