Service Load Balancing

A service provides network connection on a set of ports to a cluster of containers matching the service label selector.

Services offer:

  • Easy scaling up and down.
  • Efficient load balancing.
  • Minimal downtime.

A provider is one or more containers that match the label selector associated with the services.

Defining Services

After you create your network, you can define services using the UI, the netctl command line interface (CLI), or the Contiv Network REST APIs, but it is recommended to use the UI or API to take advantage of the authentication and authorization options in those interfaces.

Note: Service requirements are defined by selectors. Selectors are key-value pairs that group providers with matching labels.

To create a Service Load Balancer using the UI:

1. From Service Load Balancer, click Create Service Load Balanacer. service
The Create Service Load Balancer page displays.
2. Choose a name for the service load balancer.
3. Select the tenant.
4. Select the network.
5. Enter the Service IP address.
6. Under Label Selectors choose you label name and value.
7. Choose your Service and Provider ports and your Protocol.
8. Click Create.

To create a Service Load Balancer, using the CLI, run:

netctl net create [$SERVICE_NAME] -s [$SERVICE_IP_ADDRESS]

netctl service create [$APP_SERVICE_NAME] --network [$NETWORK_NAME] --tenant [$TENANT_NAME] selector=[$selector1] --selector=[$selector2] --selector=[$selector3] --port [$SERVICE_PORT]:[$PROVIDER_PORT]:[$PROTOCOL]

For example, to create a web service in a web tier for which providers must be stable and production-ready:

netctl net create contiv-srv-net -s

netctl service create app-svc --network contiv-srv-net --tenant default --selector=tier=web --selector=release=stable --selector=environment=prod --port 8080:80:TCP