6 tips for transitioning to Kubernetes

Share
  • March 13, 2019

As the new architectural approaches gain more and more popularity, companies with existing applications scramble to rewrite their old codebase. No wonder Kubernetes is all the rage, as turning a monolith into a bunch of microservices or serverless functions is no mean feat.

This article has a list of tips that will help you save time, money, and brainpower when transitioning to containers. It is based on our own experience and that of our partners.

Don’t overpay for servers

Despite Kubernetes requiring extra power for the management system, there is no need to buy top-notch servers for your application. In one of our recent projects (a social/HR platform) we advised our customer to buy the below-average server configuration. As a result the CPU load was around 5%, while memory load averaged 10%. And we still had the option to auto-scale the application.

Of course, getting more power wouldn’t hurt. But it wouldn’t be the best use of the budget either.

Don’t use session persistence load balancer

Imagine you have a building with 4 elevators. 2 of them are on the first floor and open. People are packing in and those elevators are overloaded. They can’t handle the extra weight. In a few seconds after, the 3rd and 4th elevators are opening their doors.

SEE ALSO: Next-level Kubernetes native Java framework – Quarkus brings Java on a subatomic level!

New people that just came in are going to new elevators, but those from the first two can’t because they are elevator persistent. There is a lot of space to spread the elevator load, however persistence does not allow us to use this opportunity. While without elevator persistence, people can spread between elevators and are able to go up comfortably.

The same is true with servers and session persistence. You can call it server persistence if you want.

Don’t use persistent storage for temporary files

Most applications need at least some kind of temporary data (e.g. thumbnails). This data should be shared between instances to reduce the load. There are several cases where people solved this issue by simply buying additional persistent storage space and mounting it to all the nodes.

There is a cheaper way! You can create an in-memory folder (it’s temporary data anyway) and share it between the pods in every node. It’s the same functionality for $0.

Turn off logs in Google Cloud

At the moment, the log system in Google Cloud is not working as it is supposed to. So, if you’re using Google Cloud, disable logs and use a separate service for the ones you need. Otherwise, you will receive a lot of garbage info messages.

Not only will this complicate finding the logs you need, it will cost extra.

Use CDN instead of creating multiple clusters

If there is a high load on the frontend, but not as much on the backend, people sometimes create node clusters all over the world to ensure the users can access the data faster. While this works, there is a more cost-effective way.

Creating just one cluster and using a CDN (like Cloudflare, for example) will let you do the same for free (or at least cheaper, depending on the exact provider you choose), preserving the quality and possibly even giving a better performance.

Configure the application, not Kubernetes

When you start transitioning to Kubernetes, you’ll likely find a lot of weak points and bottlenecks in your app. It might be tempting to have your DevOps guys create an ultra-customized configuration, but it is the wrong way to go. Address the issues in your application, otherwise you won’t gain anything from using Kubernetes.

SEE ALSO: Kubernetes for IoT gets lighter than ever with k3s

Let’s get back to the point 2 of this article. If your application just has to use a session persistence load balancer and won’t work without it, you can try and make it run with Kubernetes containers. Yes, you’ll be able to boast that the team is using the latest and trendiest of approaches. But you won’t get any meaningful benefits from it.

Conclusion

Google has vast experience in handling heavy load and zero-downtime rollouts. Kubernetes shows that it is a modern solution which is great “out-of-the-box”. But to exploit its potential to the fullest, you need to be patient, willing to learn, and able to adapt your application to the suggested best practices.

Kubernetes will help you build a reliable environment but it is up to you to find original ways to optimize the cost-efficiency of your project.

The post 6 tips for transitioning to Kubernetes appeared first on JAXenter.

Source : JAXenter