Skip to main content
You can expose a Kubernetes service in your Managed Service for Kubernetes cluster using a load balancer. The load balancer receives traffic on a public or private IP address, depending on how you set it up, and distributes the traffic between the service’s Pods automatically.
Requirements to connect to a VM with private IP addressTo connect to a Managed Service for Kubernetes cluster from a Compute VM using a private IP address or another cluster using a private load balancer, both must be in the same region and subnet.

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, add nebius.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.
If you have created an IP address allocation (example for public IP addresses) and want to use it to allocate an IP address to a load balancer, add its ID to the service annotation 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: To allocate a public IP address from a specific IP pool, add the pool ID to the nebius.com/load-balancer-pool-id service annotation. When this annotation is set, the IP address is allocated from the specified pool instead of the default user subnet pool. For more information about IP pools, see the Virtual Networks overview.

How to set up a load balancer

  1. 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):
  2. Create the manifest for nginx deployment (we will refer to it later as deployment.yaml):
  3. Apply the configurations:
  4. Check the service and the allocated IP address:
    You will receive an output like the one below: