Configuring service load balancers with specified backend virtual networks
Techniques are described for specifying a backend virtual network for a service load balancer. An example orchestrator of this disclosure is configured to receive a service definition for a service implemented by load balancing service traffic for the service among a plurality of backend virtual execution elements, wherein the service definition specifies a first virtual network to use as a backend virtual network for the service, to instantiate, in a selected one of the computing devices, a backend virtual execution element for the service, and to configure, based on the service definition specifying the first virtual network to use as the backend virtual network for the service, a network controller for the virtualized computing infrastructure to configure a load balancer to load balance service traffic to a first virtual network interface, of the backend virtual element, for the first virtual network.
1 . A system comprising processing circuitry having access to memory, the system configured to:
receive a service definition for a service that implements a load balancer for load balancing service traffic among a plurality of backend virtual execution elements, wherein the service definition includes an identifier of a backend virtual network, the backend virtual network comprising one of a plurality of virtual networks implemented on a physical network;
identify, based on the identifier of the backend virtual network, a virtual network interface of a virtual execution element; and
expose, based on the virtual network interface of the virtual execution element, the virtual execution element to the service that implements the load balancer for load balancing the service traffic to cause the load balancer to load balance the service traffic in part to the virtual network interface of the virtual execution element.
2 . The system of claim 1 , wherein the system is configured to:
create a load balancer member object, of the load balancer, the load balancer member object corresponding to the virtual execution element; and
annotate the load balancer member object with an annotation to specify the virtual network interface of the virtual execution element.
3 . The system of claim 2 , wherein, to expose the virtual execution element, the system is configured to:
generate a configuration update by linking a service Internet Protocol (IP) address for the service with the annotation specifying the virtual network interface of the virtual execution element; and
send the configuration update to configure a virtual router with next-hop information to cause the virtual router to load balance the service traffic, sent to the service IP address, in part to the virtual network interface of the virtual execution element.
4 . The system of claim 2 , wherein, the system is configured to, based on the annotation specifying the virtual network interface, configure the load balancer to load balance the service traffic in part to the identified virtual network interface for the backend virtual network.
5 . The system of claim 1 ,
wherein the system is configured to:
allocate a unique Internet Protocol (IP) address for the virtual execution element;
allocate a service IP address for the service; and
configure the virtual network interface of the virtual execution element with the unique IP address,
wherein to expose the virtual execution element to the service the system is configured to configure a virtual router with the service IP address and the unique IP address to cause the virtual router to load balance the service traffic, sent to the service IP address, in part to the virtual execution element.
6 . The system of claim 1 , wherein the system is configured to:
annotate configuration data for the virtual execution element to specify the backend virtual network, and
based on the annotated configuration data for the virtual execution element, send interface configuration data to a computing device that hosts the virtual execution element to configure the virtual execution element of the plurality of backend virtual execution elements with the virtual network interface to enable the virtual execution element to receive service traffic from the load balancer via the backend virtual network.
7 . The system of claim 1 , wherein the system is configured to:
receive a virtual network address for the virtual network interface of the virtual execution element for the backend virtual network; and
configure the load balancer to load balance the service traffic in part to the virtual network address.
8 . The system of claim 1 , wherein the system is configured to:
receive a virtual network address for the virtual network interface of the virtual execution element for the backend virtual network in association with a service Internet Protocol (IP) address for the service; and
configure the load balancer to load balance the service traffic, sent to the service IP address, in part to the virtual network address.
9 . The system of claim 1 ,
wherein the virtual network interface of the virtual execution element for the backend virtual network is a primary interface of the virtual execution element.
10 . The system of claim 1 , wherein the virtual execution element comprises a Kubernetes pod.
11 . The system of claim 10 , wherein the service comprises a Kubernetes service that provides access to the Kubernetes pod via a service Internet Protocol (IP) address assigned to the Kubernetes service.
12 . A method comprising:
receiving, by an orchestrator for a virtualized computing infrastructure, a service definition for a service that implements a load balancer for load balancing service traffic among a plurality of backend virtual execution elements, wherein the service definition includes an identifier of a backend virtual network, the backend virtual network comprising one of a plurality of virtual networks implemented on a physical network;
identifying, by a network controller for the virtualized computing infrastructure and based on the identifier of the backend virtual network, a virtual network interface of a virtual execution element; and
exposing, based on the virtual network interface of the virtual execution element, the virtual execution element to the service that implements the load balancer for load balancing the service traffic to cause the load balancer to load balance the service traffic in part to the virtual network interface of the virtual execution element.
13 . The method of claim 12 , further comprising:
creating, by the orchestrator, a load balancer member object, of the load balancer, the load balancer member object corresponding to the virtual execution element; and
annotating, by the orchestrator, the load balancer member object with an annotation to specify the virtual network interface of the virtual execution element.
14 . The method of claim 13 , wherein exposing the virtual execution element comprises:
generating, by the network controller, a configuration update by linking a service Internet Protocol (IP) address for the service with the annotation specifying the virtual network interface of the virtual execution element; and
sending, by the network controller, the configuration update to configure a virtual router with next-hop information to cause the virtual router to load balance the service traffic, sent to the service IP address, in part to the virtual network interface of the virtual execution element.
15 . The method of claim 12 , further comprising:
allocating a unique Internet Protocol (IP) address for the virtual execution element allocating a service IP address for the service; and
configuring the virtual network interface of the virtual execution element with the unique IP address,
wherein exposing the virtual execution element to the service comprises configuring a virtual router with the service IP address and the unique IP address to cause the virtual router to load balance the service traffic, sent to the service IP address, in part to the virtual execution element.
16 . The method of claim 12 , further comprising:
annotating, by the orchestrator, configuration data for the virtual execution element to specify the backend virtual network; and
sending, based on the annotated configuration data for the virtual execution element, the interface configuration data to a computing device that hosts the virtual execution element to configure the virtual execution element to configure the virtual execution element of the plurality of backend virtual execution elements with the virtual network interface to enable the virtual execution element to receive service traffic from the load balancer via the backend virtual network.
17 . The method of claim 12 , further comprising:
receiving a virtual network address for the virtual network interface of the virtual execution element for the backend virtual network; and
configuring the load balancer to load balance the service traffic in part to the virtual network address.
18 . Non-transitory computer-readable media comprising instructions for causing one or more programmable processors to:
receive a service definition for a service that implements a load balancer for load balancing service traffic among a plurality of backend virtual execution elements, wherein the service definition includes an identifier of a backend virtual network, the backend virtual network comprising one of a plurality of virtual networks implemented on a physical network;
identify, based on the identifier of the backend virtual network, a virtual network interface of a virtual execution element; and
expose, based on the virtual network interface of the virtual execution element, the virtual execution element to the service that implements the load balancer for load balancing the service traffic to cause the load balancer to load balance the service traffic in part to the virtual network interface of the virtual execution element.
19 . The non-transitory computer-readable medium of claim 18 , wherein the instructions further cause the one or more programmable processors to:
create a load balancer member object, of the load balancer, the load balancer member object corresponding to the virtual execution element; and
annotate the load balancer member object with an annotation to specify the virtual network interface of the virtual execution element.
20 . The non-transitory computer-readable medium of claim 19 , wherein, to expose the virtual execution element, the instructions cause the one or more programmable processors to:
generate a configuration update by linking a service Internet Protocol (IP) address for the service with the annotation specifying the virtual network interface of the virtual execution element; and
send the configuration update to configure a virtual router with next-hop information to cause the virtual router to load balance the service traffic, sent to the service IP address, in part to the virtual network interface of the virtual execution element.