What is Kubernetes?

An introduction to container orchestration with K8s

3 Min Read

Kubernetes, often abbreviated as K8s, is an open-source platform designed to automate deploying, scaling, and operating application containers. In the realm of microservices, container orchestration with Kubernetes has become an essential skill.

What is Kubernetes?

Originally designed by Google, Kubernetes is a production-grade container orchestration system that's been open-sourced. It provides a framework to run distributed systems resiliently, scaling and recovering applications as needed.

Kubernetes Architecture

At a high level, Kubernetes is composed of a cluster of nodes, which could be physical or virtual, on-premise or in the cloud. Each cluster contains a master node and multiple worker nodes.

  • The Master Node is responsible for maintaining the desired state of the cluster, such as which applications or services should be running and which nodes should host them.
  • Worker Nodes run the applications and workloads. Each node contains the necessary services to run Pods (smallest deployable units in Kubernetes), communicate with the master node, and configure networking.

Key Features of Kubernetes

  • Automatic Binpacking: Kubernetes automatically schedules containers based on resource usage and constraints, without sacrificing availability.
  • Self-Healing: Kubernetes can automatically replace, kill, and reschedule containers when they fail.
  • Horizontal Scaling: Applications can be easily scaled up or down based on demand with a simple command, using a UI or automatically based on CPU usage.
  • Service Discovery and Load Balancing: Kubernetes can expose a container using DNS or their own IP address. If traffic to a container is high, Kubernetes can load balance and distribute network traffic to stabilize the deployment.

Kubernetes and Microservices

Kubernetes provides several key features that align well with a microservices architecture:

  • Isolation: Kubernetes ensures that workloads are isolated in their respective containers and namespaces, which helps maintain the independence of individual microservices.
  • Networking: Kubernetes provides each Pod with a unique IP address and a single DNS name for a set of Pods, simplifying the task of managing network communication between microservices.
  • Load Balancing: Kubernetes automatically load balances requests between different services, and between different Pods within a service.
  • Scaling: Kubernetes enables you to scale your microservices using simple commands, ensuring that your applications can handle varying loads.
  • Rollouts and Rollbacks: Kubernetes allows you to roll out updates to your microservices, while also offering the ability to rollback to a previous version if something goes wrong.

Container orchestration using Kubernetes has become commonplace in modern backend development and DevOps, especially when working in a microservices environment. Kubernetes not only automates many of the tasks related to managing a distributed system, but it also provides robustness, scalability, and flexibility for your microservices.

What now?

For a closer look into Kubernetes, you can start with the Kubernetes Basics tutorial.

Ready to escape the hamster wheel?

Encore is Backend Development Platform purpose-built for creating event-driven and distributed systems — from developing locally to scaling in your cloud on AWS/GCP.