Bobcares

OVH Kubernetes Loadbalancer | Integration

by | Apr 24, 2024

Learn how to integrate OVH Kubernetes & Loadbalancer. Our OVH Support team is here to help you with your questions and concerns.

OVH Kubernetes Loadbalancer | Integration

Did you know that a load balancing service helps users with “LoadBalancer ServiceType” on OVHcloud Managed Kubernetes clusters?

OVH Kubernetes Loadbalancer

Today, our experts are going to walk us through deploying a simple “Hello World” Load Balancer service. It uses the power of OVHcloud’s managed Kubernetes infrastructure.

How to Create a Hello World Load Balancer Service

  1. First, we have to create a YAML file named `hello.yml` for our `ovhplatform/hello` Docker image. This file defines the service type as LoadBalancer:


    apiVersion: v1
    kind: Service
    metadata:
    name: hello-world
    labels:
    app: hello-world
    spec:
    type: LoadBalancer
    ports:
    - port: 80
    targetPort: 80
    protocol: TCP
    name: http
    selector:
    app: hello-world
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: hello-world-deployment
    labels:
    app: hello-world
    spec:
    replicas: 1
    selector:
    matchLabels:
    app: hello-world
    template:
    metadata:
    labels:
    app: hello-world
    spec:
    containers:
    - name: hello-world
    image: ovhplatform/hello:1.1
    ports:
    - containerPort: 80

  2. After the file is ready, apply it as seen here:

    kubectl apply -f hello.yml

    Now, a new `hello-world` service and `hello-world-deployment` deployment are created.

  3. We can verify the deployment by listing the services:

    kubectl get service hello-world -w

    Initially, we may see `pending` under EXTERNAL-IP as the Load Balancer creation is asynchronous. So, wait a few minutes and recheck. We will soon see EXTERNAL-IP.

  4. Then, direct the browser to the EXTERNAL-IP value, and the `hello-world` service will respond. This confirms successful deployment.
  5. After the above steps, it is time to clean up by deleting the service and the deployment:

    kubectl delete service hello-world
    kubectl delete deploy hello-world-deployment

How to Connect OVH Load Balancer to Kubernetes Cluster

If we want to connect an OVH Load Balancer to a Kubernetes Cluster from the OVH Cloud provider, we have your back.

First, create a Kubernetes Ingress exposed on a NodePort. Alternatively, we can expose our services directly on a NodePort and configure the load balancer’s backend to all nodes in the cluster on that specific NodePort.

Additionally, we can add this to the Kubernetes infrastructure provisioning with Terraform. By managing endpoints for the load balancer based on instances provisioned manually or via the OpenStack provider, we can integrate OVH Load Balancer functionalities into the Kubernetes setup.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

In brief, our Support Experts demonstrated how to integrate OVH Kubernetes & Loadbalancer.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.