me
Published on

When and Why should you use rancher

Authors
  • avatar
    Name
    Omer Atagun
    Twitter

Problems of scaling is known issue for pretty long time, its painful and open to problems generously. This is exactly when k8s/k3s or orchestration software like rancher comes in handy.

Why ?

  • Because you need to scale your application due to high traffic. Yes just because of that. But are there any comforts that i could use of even if did not need scaling ? Answer is yes but i suggest not to because it takes time and resources for such small size application.

When ?

  • Lets examine a situation of two different application that requires different deployment.

    Deployment scenario for Static HTML page.

    Imagine you have a landing page for your client that will have an information about the company, its team and contact information. Data will highly likely never change and even if it does, you might spend 5 minutes to change phone number and deploy back again.

    If this landing page is for small size company, safe to think that there will be visitors once a while let's assume once a day, for this you should never bother yourself with scaling problems because you do not have any. It is just fine to use platforms like netlify or some budget resources VPS to get job done

    What if this company got popular and demands bigger resources such as process power, ram, bigger network and so. Yes this is the exact moment, you have to start thinking either scaling vertically or horizontally.

    First, you would try to get bigger VPS but then after a short time, you would get bigger one, then again and again. You already got the idea how that is a problem. Each time you have to set up required pieces of software to run your application. E.g some linux distro, nginx/treafik/apache, firewall.

    If you did dockerized your deployment, yes its relatively lesser time but how can we be so sure the hardware we have picked will be fine for the load and what if we lose the traffic? we'd be keep paying the bigger hardware bills. Which is a waste of business resources.

    All right, we got the idea, we need something that can do all this fuss without we are present and having a domain knowledge at any moment. That is the exact job description for Kubernetes and docker.

    What is Docker now? where that thing came from? There are a lot of resources explains that, we skip this part. Yet, it is simply a container that contains your application with its requirements.

    So then, what is Kubernetes? it is a manager for your Docker containers. Somebody got to manage and make them communicate in between each other so that will not be you, now its time to be happy.

    Now, back to when and why we are using kubernetes and rancher.

    We can simply scale the application of ours as we mentioned above in a neat and automated way. A very basic graphical presentation could help you understand

    Rancherk3s

    What we have here is when a user requests our service/application we have a load balancer that forwards this request to related service and this service gets the information/data from the Worker/Server and related pods and shows to our user. Considering our static html does not require anything else, we can scale this to any amount of requests we can have.

    Whenever we need more servers, we can just add one more and all will be done automatically by our orchestration. Good part is that we can add another services/applications that uses same resources.

    Deployment scenario for Multiple services

    Above example was relatively easy to handle and do the cool stuff. But now lets say we have a service that needs to communicate other service, what then ? Well that is also pretty easy. Especially in Rancher.

    E.g we have 2 services one is NodeJS application and other is mongodb. These two have to communicate/transmit data in order to process requests and response back something we wanted to.

    You would have each service as different deployments and connect them within the cluster itself, and they would do their job. Visual presentation below;

    Rancherk3s

    When a service requires to communicate others, we simply state in our environment and say that "when you need a mongodb connection, look at in which private ip/pod/worker/server its exposed and go there". Cool stuff right ?

What other cool stuff is in there ?

Well a lot. Rancher was doing thing differently in its early versions like v1x such as trying to provide helm charts ( package manager for kubernetes ) by themselves and maintain them. This was too much of a problem/work to keep them up and provide support for it. They have released some of duties away and as you can see, a lot more new stuff in short amount of time is in action!

I'd like to mention some of them such as;

  • Auto-scaling with your favorite service providers such as AWS, GCloud, linode
  • Load balancer level SSL encryption ( so your apps does not concern any of this )
  • Horizontal pod autoscaler - depends on your metrics, scale your stuff horizontally, thats the cool stuff.
  • Very easy persistent storage usage with Longhorn
  • Rancherk3s
  • Easy multiple cluster management

This pretty much sums up when and why should you use rancher. No matter what i said, you may find your own reason and experiment it on the way. Most likely i have missed some things to mention but if you were to talk and exchange knowledge, reach me out!.

Until the next post stay hydrated