Here we will learn about the key features of containers and the advantages of using containers for application deployment compared to alternatives such as deploying apps directly to virtual machines.
Monolithic vs Microservices
|A Single application containing all the components||This is a collection of small and independent services that communicate with each other to form a complete application.|
|The entire application must be deployed, even for small updates.||Only the affected or updated services need to be redeployed, thus reducing the risk and deployment time.|
|Development is done through a single codebase, but updates and changes become more complex as the codebase grows||Each service is developed and maintained separately, allowing for faster updates and also making debugging easier.|
|The Application is not fault tolerant. Since a failure in one component can impact the entire application.||Here the application is fault tolerant. Since the failure of one service is less likely to affect others.|
|Scalability is a issue here. Because the entire application needs to be scaled and there could be a resource under or over-utilization.||The Scalability issue is solved here. Since each service can be scaled independently, improving resource utilization.|
|Example: Instagram||Example: Amazon|
Comparing Deployment Types
Earlier organizations ran applications on physical servers. To set one up, they would find physical space, power and network connectivity for it, and then install an operating system, any software dependencies, and finally the application. If you need more processing power, redundancy, security, or scalability, add more computers.
This wasted resources and took a lot of time to deploy, maintain, and scale. It also wasn’t very portable: applications were built for a specific operating system and sometimes for specific hardware.
As a solution, virtualization was introduced. Virtualization helped by making it possible to run multiple virtual servers and operating systems on the same physical computer. Here an additional layer called the Hypervisor was added. A hypervisor is the software layer that breaks the dependencies of an operating system on the underlying hardware and allows several virtual machines to share that hardware.
Virtualization allows better utilization of resources in a physical server and allows better scalability because an application can be added or updated easily, reduces hardware costs, and much more.
The isolation issue was solved here, but to Scale this for hundreds or thousands of applications and you see its limitations.
Containers are lightweight, standalone, resource-efficient, portable, executable packages.
Containers are lightweight because they don’t carry a full operating system.
A container has its filesystem, share of CPU, memory, process space, and more. As they are decoupled from the underlying infrastructure, they are portable across clouds and OS distributions.
Finally, containers make it easier to build applications that use the microservices design pattern: that is, loosely coupled, fine-grained components. This modular design pattern allows the operating system to scale and upgrade components of an application without affecting the application as a whole.
An application and its dependencies are called an image.
A container is simply a running instance of an image. By building software into container images, developers can easily package and ship an application without worrying about the system it will be running on.
Why you need Kubernetes
Kubernetes is an essential tool for managing containerized applications at scale. Several reasons why Kubernetes is required:
Automated deployment, scaling, and management: Kubernetes automates the deployment, scaling, and management of containerized applications, allowing you to focus on your application development and maintenance.
Improved resource utilization: Kubernetes can optimize resource usage by allocating appropriate resources to containers based on their requirements, ensuring better utilization of resources across your infrastructure.
Self-healing: Kubernetes can detect and fix issues within your application, such as restarting failed containers or rescheduling them to a healthy node.
Versioning and rollbacks: Kubernetes allows you to update your application easily and roll back to the previous version if required, minimizing downtime and ensuring stability.
Multi-cloud and hybrid-cloud support: Kubernetes simplifies the deployment and management of applications across different cloud platforms or on-premises, enabling you to build a truly cloud-native infrastructure.
Secret and configuration management: Kubernetes lets you store and manage sensitive information, such as passwords, OAuth tokens, and SSH keys. You can deploy and update secrets and application configuration without rebuilding your container images, and without exposing secrets in your stack configuration.
Kubernetes Architecture and its Components.