Prerequisites
Before you start setting up a load balancer, you need to create a Managed Kubernetes cluster and connect to it using kubectl.Load balancers types
By default, load balancers are created with public IP addresses. To expose your service on a private IP address instead, addnebius.com/load-balancer-type: internal to the annotations of the service.
To retain an IP address that was automatically allocated to a load balancer and reuse it after deleting or recreating the service, follow the How to convert a dynamically assigned public IP address to a reusable allocation guide.
nebius.com/load-balancer-allocation-id. The allocation type (public or private) must match the load balancer type.
The table below explains how these two annotations work together:
Type is internal | Allocation ID is set | Result |
|---|---|---|
| Yes | Yes | Load balancer gets a private IP address from the provided allocation |
| Yes | No | Load balancer gets a private IP address from a new allocation |
| No | Yes | Load balancer gets a public IP address from the provided allocation |
| No | No | Load balancer gets a public IP address from a new allocation |
How to set up a load balancer
- With a private IP address
- With a public IP address
-
Create the manifest to set up the internal load balancer service with a private IP address (we will refer to it later as
service.yaml): -
Create the manifest for nginx deployment (we will refer to it later as
deployment.yaml): -
Apply the configurations:
-
Check the service and the allocated IP address:
You will receive an output like the one below: