diff --git a/README.md b/README.md index 182d295c..841a54cb 100644 --- a/README.md +++ b/README.md @@ -1139,7 +1139,37 @@ $ civo objectstore credential delete cli-demo-fa5d-7de9b2 Warning: Are you sure you want to delete the cli-demo-fa5d-7de9b2 Object Store Credential (y/N) ? y The Object Store Credential (cli-demo-fa5d-7de9b2) has been deleted ``` +## Load balancers +On Civo, Kubernetes cluster LoadBalancer objects are external to your cluster, but created and managed as part of your cluster's service definitions. In other words, you create them like other Service objects in Kubernetes as part of your cluster definition, but their state is handled by the Cloud Controller Manager that speaks to the Civo API. This allows you to have a service that routes traffic into your cluster externally, balancing the traffic between the nodes. +### Creating a Kubernetes load balancer +Being strictly a Kubernetes object, Kubernetes load balancers must be defined in a running cluster. There is no way to start a Kubernetes load balancer for a cluster from the dashboard, as they are application-specific. + +Definining a load balancer can be done either using kubectl to define a Service in your cluster, or by launching a Marketplace application that defines one for you. The documentation below shows the creation of a load balancer using kubectl as Marketplace applications configure them automatically. + +To define a Civo Kubernetes load balancer object, at a minimum you need to define the Service and its type as LoadBalancer, such as: +```sh +apiVersion: v1 +kind: Service +metadata: + name: civo-lb-service +spec: + type: LoadBalancer + selector: + app: example-app + ports: + - protocol: TCP + port: 5000 + targetPort: 8443 + name: example-app +``` + +### Deleting a Kubernetes load balancer +The Cloud Controller Manager (CCM) running in your cluster will handle the deletion of a Civo load balancer once the accompanying Service is deleted from your cluster. You can delete the load balancer, and stop billing for the load balancer, by either deleting the service definition using the manifest file as in the example below, or by deleting the service from the cluster itself: +```sh +$ kubectl delete -f loadbalancer.yaml +service "civo-lb-service" deleted +``` ## Quota