TechnicalPigđŸ·: Kubernetes

Finally understanding Kubernetes

Kubernetes is an open source platform for managing containerised workload and services. It facilitates both declarative configuration and automation.

Before Kubernetes

brief history of deployments

Traditional deployment era: In the traditional deployment era, organisations ran applications on physical servers without the ability to set resource boundaries, leading to allocation issues when multiple applications competed for resources. This often resulted in underperforming applications.

A potential solution was using separate servers for each application, but this approach was costly and led to underutilised resources.

Virtualised deployment era: In the virtualised deployment era, virtualisation allowed multiple virtual machines (VMs) to run on a single physical server's CPU through the use of a hypervisor.

The hypervisor allows multiple systems to run concurrently on a single physical host by managing and allocating the host’s resources to each VM. It also isolates applications within VMs, enhancing security by preventing applications from accessing each other's data.

Virtualisation improves resource utilisation and scalability, making it easier to add or update applications. It also reduces hardware costs by presenting physical resources as a cluster of disposable VMs, with each VM running its own operating system on the virtualised hardware.

Container deployment era: Containers are similar to VMs but the are more “lightweight”. They require the application and its dependencies but not a full OS which drastically reduces their size and overhead.

Similar to a VM, a container has its own filesystem, share of CPU, memory, process space, and more. Containers start almost instantaneously because they do not need to boot an OS; they simply start the application process.

This is done through the use of container runtime. Container runtime is a software that -

  • Instantiation: creates containers from images.

  • Isolation: keeps containers isolated from each other and the host system.

  • Resource allocation: allocates and manages resources like CPU among different containers.

  • Lifecycle management: manages the starting, stopping and managing of container processes.

Kubernetes

Kubernetes helps you manage your containers. It enhances container management by automating deployment, scaling, and operations of application containers across clusters of hosts. It provides high availability, load balancing, rolling updates, and more, making it highly effective for managing containerised applications at scale.

Some key features:

  • Load balancing: If traffic to a container is high, Kubernetes is able to load balance and distribute the network traffic so that the deployment is stable.

  • Storage orchestration: Applications often require access to storage resources that persist beyond the lifecycle of individual containers. Kubernetes simplifies the details of storage infrastructure, making it easy for you to manage the needs of your application.

  • Automated rollouts and rollbacks: These capabilities allow for controlled updates to applications and enable easy recovery from potential failures during updates.

  • Automatic bin packing: Kubernetes looks at how much resources you want to allocate to your container and will try to place containers in a way that efficiently utilises the CPU of each node.

  • Self-healing Kubernetes restarts containers that fail, replaces containers, kills containers that don't respond to your user-defined health check, and doesn't advertise them to clients until they are ready to serve.

  • Secret and configuration management Kubernetes lets you store and manage sensitive information, such as passwords, OAuth tokens, and SSH keys.

  • Horizontal scaling Scale your application up and down.

Kubernetes and ECS


ECS (Amazon Elastic Container Service) and Kubernetes are both container orchestration tools. While Kubernetes is an open-source platform, ECS is a service provided by AWS.

For teams looking to leverage Kubernetes within AWS, Amazon offers Amazon Elastic Kubernetes Service (EKS), which simplifies deploying, managing, and scaling Kubernetes applications using AWS infrastructure.