Kubernetes is a fastly developing and promising framework for container orchestration. Created by Google, it allows for deploying cloud infrastructures with any level of complexity, managing, and maintaining.
Using Kubernetes is supposed to bring flexibility, scalability, painless management, and support into web application development. Let’s find out if this platform is really that good. In this article, we’ll take a look at Kubernetes key components, its pros and cons, and cases when it’s worth to implement the framework.
Kubernetes key components
The cornerstone of framework infrastructure is Kubernetes API. All commands and communications between network elements are API calls to the server. In order to create a simple application with Kubernetes, you need to study its operations and basic information about other infrastructure objects. However, deeper knowledge is required for developing a complex solution.
Kubernetes infrastructure consists of clusters — sets of nodes that host your applications. A cluster is configured with a declaration file that describes applications it should run, the number of nodes and Pods it contains, resource usage limitations, etc. This is the biggest and the most complex one of all the Kubernetes concepts.
A cluster consists of nodes — machines that contain Pods and services for Pod operation. Those machines can be both virtual and physical. There are Master and working nodes.
A Master node is in charge of maintaining the desired state of a cluster. It contains several elements:
- API server — It validates commands from Kubernetes API and communicates them to the other parts of a cluster.
- Controller manager — An entity that governs controllers run within a cluster. A controller is a service that is called to maintain the desired state of a cluster.
- Scheduler — A tool for managing newly created Pods.
- etcd database — An internal store that contains key-value data for a cluster, such as Pod configurations, templates, logs, etc.
A working node contains elements for container engine and Pods.
A Pod is the smallest Kubernetes unit. It runs a container. The amount and configuration of Pods are designed by controllers. Also, it’s possible to create a Pode manually. In some cases, a single Pod runs multiple containers. For example, if an application consists of several containers that require access to the same resources.
When an application is deployed, you can manage it by creating new controllers or changing declarations of the network desired state.
Those are only the basic Kubernetes components. If you want to study the network more thorough, you can check out its documentation. Now, let’s review what advantages and disadvantages such structure brings to Kubernetes.
Kubernetes pros and cons
Key advantages of Kubernetes are:
- Scalability — Declarative nature of Kubernetes allows for automatic scalability. The deployment controller changes the amount of running Pods and nodes based on the declaration file.
- Portability — Kubernetes is compatible with a lot of PaaS providers, including Microsoft Azure, Google Compute Engine, Amazon Web Services, Rackspace, VMware vSphere. Therefore, it’s possible to deploy a project using several providers or move it from one to another.
- Automatization — After deployment, the Kubernetes network supports itself without much involvement from the developers. The ReplicaSet controller maintains the desired state of the Pods, creating and terminating them if necessary.
- Modularity — Kubernetes’ structure is modular, meaning that you can use only those parts of the framework you need.
- Faster delivery processes compared to other containerization platforms — Kubernetes was created with application update during uptime in mind. It’s especially useful if your project requires continuous updates.
The main cons of Kubernetes are:
- High entry barrier — Deploying a simple application with Kubernetes seems like an easy task. However, in-depth learning of Kubernetes takes time and experience with container management.
- Need for a standalone monitoring tool — The framework isn’t equipped with tools for network monitoring. In order to collect data about your system, you need either to create a custom Kubernetes resource or employ a standalone tool.
- No storage service — Unlike AWS or Microsoft Azure, Kubernetes doesn’t provide you with embedded storage. You need to use local servers or a PaaS solution to deploy your project.
- Limited documentation — Kubernetes has documentation that covers key processes in the platform. However, if you need an out-of-the-box solution, you’ll have to figure out how to develop it with Kubernetes by yourself.
When to use Kubernetes
Kubernetes key features and its high performance made it a popular framework for deploying a web application. Here are several cases when it’s recommended to use Kubernetes for your project:
- if you want to implement the serverless architecture or use various service providers. Following this approach, you can concentrate only on writing code, and let a cloud provider handle any issues with the servers. Kubernetes infrastructure can employ combinations of local servers and a cloud provider or several cloud providers.
- if your project needs working under variable loads. Kubernetes allows for creating controllers that maintain your infrastructure in the desired state despite the load. For example, Reddit, one of the most popular websites in the world, moved its infrastructure to Kubernetes.
- if your project requires great scalability and operation all around the world. Other Kubernetes tools can scale your network by simply creating new pods and clusters when the old ones are overloaded. This was the case for PokemonGo — a mobile app that rapidly became a global phenomenon. Niantic moved their servers to Kubernetes in order to achieve planetary-scale cluster orchestration instead of manual setup for each region. PokemonGo case was the biggest deployment in Kubernetes.
- if you want to migrate your project to a more stable and supported containerization platform. This was the case for Spotify. This audio-streaming platform used a custom solution for container management. They came to the conclusion that supporting old technology isn’t efficient. Migration to Kubernetes allowed Spotify to free its developers from maintaining a custom solution and add new features to improve its infrastructure.
Conclusion
Kubernetes has proven itself as a useful framework for web app development. It allows a developer to achieve remarkable results. However, the development process with Kubernetes contains hidden rocks due to several reasons:
- Lack of detailed documentation on uncommon cases.
- The high entry barrier for new developers.
- The fast evolvement of the framework, that leads to compatibility issues between Kubernetes components.