# Connection between KONG and Apis in a kubernetes implementation?

**URL:** <https://discuss.konghq.com/t/connection-between-kong-and-apis-in-a-kubernetes-implementation/3102>\
**Category:** Questions\
**Tags:** kubernetes\
**Created:** [March 25, 2019, 6:01pm UTC](https://discuss.konghq.com/t/connection-between-kong-and-apis-in-a-kubernetes-implementation/3102 "2019-03-25T18:01:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ldipotet](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/ldipotet/32/4842_2.png) [@ldipotet](https://discuss.konghq.com/u/ldipotet)\
**Post date:** [March 25, 2019, 6:01pm UTC](https://discuss.konghq.com/t/connection-between-kong-and-apis-in-a-kubernetes-implementation/3102/1 "2019-03-25T18:01:22Z")

</div>

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**?

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [March 25, 2019, 7:40pm UTC](https://discuss.konghq.com/t/connection-between-kong-and-apis-in-a-kubernetes-implementation/3102/2 "2019-03-25T19:40:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ldipotet](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/ldipotet/32/4842_2.png) [@ldipotet](https://discuss.konghq.com/u/ldipotet)\
**Post date:** [March 26, 2019, 11:01am UTC](https://discuss.konghq.com/t/connection-between-kong-and-apis-in-a-kubernetes-implementation/3102/3 "2019-03-26T11:01:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [March 27, 2019, 1:42pm UTC](https://discuss.konghq.com/t/connection-between-kong-and-apis-in-a-kubernetes-implementation/3102/4 "2019-03-27T13:42:19Z")

</div>

> [@ldipotet](#):
>
> 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**

Either way will work but lead to different behaviors as the [DNS setup for a LoadBalancer and a Headless service](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#services) 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.
