A Balancer accepts incoming traffic and balances it between the Processes of a Service.
A Balancer is defined in convox.yml
.
balancers:
custom:
annotations:
- test.annotation.org/value=foobar
service: mqtt
ports:
8883: 8883
services:
mqtt:
ports:
- 8883
whitelist:
- 192.168.0.0/16
Name | Required | Description |
---|---|---|
annotations | no | A list of annotation keys and values to populate the metadata for the deployed balancer |
ports | yes | A map of ports in the format listen:forward where listen is the port that the balancer will listen on and forward is the port that the traffic will be forwarded to on the Service |
service | yes | The name of the service that will receive the traffic |
whitelist | no | A list of CIDR ranges from which to limit inbound traffic to this balancer |
$ convox balancers
BALANCER SERVICE ENDPOINT
custom mqtt 1.2.3.4
To configure TCP ports on a balancer, you can use the following example:
balancers:
custom:
annotations:
- test.annotation.org/value=foobar
service: web
ports:
5000: 3001
5002: 3002
services:
web:
domain: ${HOST}
build: .
port: 3000
ports:
- 3001
- 3002
To configure UDP ports on a balancer, specify the protocol explicitly for UDP ports. The default protocol is TCP, so it does not need to be specified for TCP ports.
balancers:
custom:
annotations:
- test.annotation.org/value=foobar
service: web
ports:
5000:
protocol: UDP
port: 3001
5002:
protocol: UDP
port: 3002
services:
web:
domain: ${HOST}
build: .
port: 3000
ports:
- 3001/udp
- 3002/udp
ports:
will never be publicly accessible; all connections must go through the load balancer, which is internet-facing.port
and ports
services:
web:
domain: ${HOST}
build: .
port: 3000
ports:
- 3001/udp
- 3002
By using the ports
attribute, you can configure additional ports with specific protocols on both the Kubernetes service and pod levels.
Note: The main
port
must always be defined, and it will use the default ingress. Health checks go over the port defined asport:
.
You can configure an alternate health check port using the ports
attribute.
balancers:
custom:
annotations:
- test.annotation.org/foo=bar
service: web
ports:
5000: 3001
5002: 3002
services:
web:
domain: ${HOST}
build: .
port: 3000
ports:
- 3001
- 3002
In this configuration, the main traffic goes through port 3000, while additional service communication uses ports 3001 and 3002.
Note: Ports defined with the
ports:
attribute will only be accessible within the cluster and through the configured custom balancer.
For more detailed information on configuring load balancers, refer to the Load Balancers documentation page.