Creating Load Balancers in OKS
You can give customers open access to your clusters using OKS load balancers. An OKS load balancer is a kubernetes cluster entry that is responsible for detecting load balancer creation requests in the manifests that are applied to a cluster, creating the corresponding Load Balancing Unit (LBU), and attaching the newly created LBU to your cluster.
For more information about load balancers, see Load Balancing Unit (LBU).
Creating a Load Balancer
To create a load balancer, you have to attach the required annotations to your manifests.
In the following example, we will create a basic load balancer granting HTTPS access to the resources on the cluster.
This micro-application would watch for HTTP requests on the TCP port 80 and return the received request headers as a response:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoheaders
namespace: default
labels:
app: echoheaders
spec:
replicas: 1
selector:
matchLabels:
app: echoheaders
template:
metadata:
labels:
app: echoheaders
spec:
containers:
- name: echoheaders
image: gcr.io/google_containers/echoserver:1.10
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: echoheaders-lb-public
namespace: default
labels:
app: echoheaders
annotations:
service.beta.kubernetes.io/osc-load-balancer-name: "simple-lb-test"
spec:
ports:
- port: 80
name: http
protocol: TCP
targetPort: 8080
selector:
app: echoheaders
type: LoadBalancer
Using Annotations in Your Load Balancers
The table below lists supported annotations for your OKS load balancers.
Lists should be comma-separated unless specified otherwise. |
Annotation | Mutability | Description | Default value | ||
---|---|---|---|---|---|
|
No |
The name of the load balancer. |
If longer that 31 characters, it is truncated. |
||
|
No |
The scheme (or type) of the load balancer. |
internet-facing This value can be set to internet-facing or internal. |
||
|
Yes |
The list of node pools to use as backend VMs on the LBU. For example: |
|
||
|
Yes |
The list of key-value pairs which will be recorded as additional tags in the ELB. For example: |
None |
||
|
Yes |
The list of CIDRs allowed to access the load balancer. |
|||
|
Yes |
The list of CIDRs allowed to access the load balancer. |
|
||
|
Yes |
The time between two health check requests (from 5 to 600 seconds). |
30 |
||
|
Yes |
The number of health check requests that must succeed consecutively in order to consider the node healthy (from 2 to 10). |
10 |
||
|
Yes |
The optional URL path for health check requests, only used with HTTP or HTTPS health check protocols. For example: |
None |
||
|
Yes |
The port number for health check requests (from 1 to 65535). |
Assigned automatically to the nodePort of the service. |
||
|
Yes |
The protocol for health check requests (among HTTP/HTTPS/TCP/SSL). |
Assigned automatically to the protocol of the service. |
||
|
Yes |
The maximum waiting time for a response before considering the node unhealthy (from 2 to 60 seconds). |
5 |
||
|
Yes |
The number of health check requests that must fail consecutively in order to consider the node unhealthy (from 2 to 10). |
2 |
Related Pages