Question

Switch the Kubernetes cluster associated with a Digital Ocean load balancer

Hello,

I had to destroy a Kubernetes cluster and recreate it, because it was in a completely broken state.

The cluster was associated with a DigitalOcean load balancer. I would rather not create a new load balancer with a different IP address, because I already have DNS records pointing to the existing load balancer. Is it possible to modify the existing load balancer to point to the new Kubernetes cluster? I could not find a way to do this in documentation.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

Looking at a LB service you should see they are provisioned with the loadbalancer id annotation.

To reuse a current already provisioned LB. You can use that annotation on the service that you want to take over the LB:

kubernetes.digitalocean.com/load-balancer-id: xxxxxx-blah-UUID-here-xxx

Please note that you should not have a LB being managed by two clusters as they will overwrite each others configurations.

Hope this helps!

Hi, what’s the structure (i.e. architecture) of your Kubernetes resources? Are you using a LoadBalancer in regards to your service resource definition? If this is the case, then you should never hard code an IP address here. Next, If you have created a DNS record that has an associated IP address, then I would create a Kubernetes Ingress resource using either Nginx or Traefik that sets the domain and not the IP.

e.g.

kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: "foo"
  namespace: production
spec:
  rules:
    - host: some.example.com
      http:
        paths:
          - path: /
            backend:
              serviceName: some_service_1
              servicePort: 80

Note: The above is using Traefik apiVersion.

Well, I wish that the above information helps you and happy hacking.

Think different and code well,

-Conrad