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: LoadBalancerUsing 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. | 
 This value can be set to  | ||||
| 
 | Yes | The list of node pools to use as backend VMs on the LBU. For example:  | 
 | ||||
| 
 | No | The optional name of the IP pool that is linked to the Public IP that you want to use for the Load Balancer. For example:  | None | ||||
| 
 | Yes | The list of key-value pairs to record as additional tags in the LBU. For example:  | None | ||||
| 
 
 | Yes | The list of CIDRs allowed to access the load balancer. | 
 | ||||
| 
 | Yes | The time between two health check requests (from 5 to 600 seconds). | 
 | ||||
| 
 | Yes | The number of health check requests that must succeed consecutively in order to consider the node healthy (from 2 to 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). | 
 | ||||
| 
 | Yes | The number of health check requests that must fail consecutively in order to consider the node unhealthy (from 2 to 10). | 
 | ||||
| 
 | Yes | The amount of time, in seconds, that the connection is allowed to be idle (meaning no data is sent over), before it is closed by the load balancer. | 
 
 | ||||
| 
 | Yes | Specifies whether to enable or disable the proxy protocol to transfer connection information from a client (such as client IPs) to the load balancer backend VMs ( | None | ||||
| 
 | Yes | The IP mode of the Ingress ( | 
 
 | ||||
| 
 
 | Yes | The returned external address(es) of the load balancer’s Ingress ( | 
 
 | 
Related Pages