# How to expose service as a load balancer of type classic aws load balancer

**URL:** <https://forums.percona.com/t/how-to-expose-service-as-a-load-balancer-of-type-classic-aws-load-balancer/22234>\
**Category:** Percona Operator for MongoDB\
**Created:** [May 22, 2023, 9:44am UTC](https://forums.percona.com/t/how-to-expose-service-as-a-load-balancer-of-type-classic-aws-load-balancer/22234 "2023-05-22T09:44:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kay\_Khan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/kay_khan/32/17023_2.png) [@Kay\_Khan](https://forums.percona.com/u/Kay_Khan)\
**Post date:** [May 22, 2023, 9:44am UTC](https://forums.percona.com/t/how-to-expose-service-as-a-load-balancer-of-type-classic-aws-load-balancer/22234/1 "2023-05-22T09:44:07Z")

</div>

Hi friends,

By default the mongodb is exposed as a `NLB`. I would like to set it so that that it is exposed as a `classic` load balancer. How can i do that? I have tried setting the following annotation, but it continues to expose the service as an `NLB`

```auto
    expose:
      enabled: true
      exposeType: LoadBalancer
      # loadBalancerSourceRanges:
      # - 10.0.0.0/8
      serviceAnnotations:
        service.beta.kubernetes.io/aws-load-balancer-type: classic
        # service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http

```

Also tried the values `external` and `alb` they all create a `nlb`

---

<div class="post-metadata">

**Author:** ![Kay\_Khan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/kay_khan/32/17023_2.png) [@Kay\_Khan](https://forums.percona.com/u/Kay_Khan)\
**Post date:** [May 22, 2023, 11:28am UTC](https://forums.percona.com/t/how-to-expose-service-as-a-load-balancer-of-type-classic-aws-load-balancer/22234/2 "2023-05-22T11:28:54Z")

</div>

The AWS Load balancer controller by default no longer supports the creation of classic load balancer. Usually a classic load balancer will be created by not specifying the annotation `service.beta.kubernetes.io/aws-load-balancer-type`

> <https://github.com/kubernetes-sigs/aws-load-balancer-controller/issues/2863>
>
> Does this or did this support provisioning elbs for service types? I'm trying to… figure out what is creating a classic elb in my cluster based on the service annotations and I have an older version of this controller running. The docs seem to indicate that it only supports the newer alb/nlb. If it did change - what version? 
> 
> nlb has a much smaller keep alive window compared to a elb.

Instead we should use `Network Load Balancer`

> [@MongoServerSelectionError: Server selection timed out after 30000 ms](https://forums.percona.com/t/mongoserverselectionerror-server-selection-timed-out-after-30000-ms/21891):
>
> I have deployed the percona operator and MongoDB server on my kubernetes cluster. I am exposing the service externally via Loadbalancer. As of this new installation today i’m no longer able to externally connnect. I get the following error: MongoServerSelectionError: Server selection timed out after 30000 ms mongosh --host k8s-mongodb-psmdbdbr-13dd3882fd-14dc163145fe98e1.elb.us-east-2.amazonaws.com:27017 --username databaseAdmin --authenticationDatabase admin Enter password: \*\*\*\*\*\*\*\*\*\*\*\*\*\*…

---

<div class="post-metadata">

**Author:** ![rdxmbr](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rdxmbr](https://forums.percona.com/u/rdxmbr)\
**Post date:** [May 22, 2023, 1:35pm UTC](https://forums.percona.com/t/how-to-expose-service-as-a-load-balancer-of-type-classic-aws-load-balancer/22234/3 "2023-05-22T13:35:21Z")

</div>

please also note [splitHorizon DNS? - #7 by Sergey\_Pronin](https://forums.percona.com/t/splithorizon-dns/20205/7)
