DEV Community

Cover image for Docker & Kubernetes
Ibrahim S
Ibrahim S

Posted on

Docker & Kubernetes

Docker

A container is like a compact box holding an application’s dependencies all in one place. This not only allows an application to run quickly but also makes it portable and easy to transfer from one environment to another.

Docker Swarm is Docker’s native open-source container orchestration solution and an alternative to Kubernetes.

It offers scaling, multi-host networking, automatic load balancing, and all other features required for mass container deployment and administration without depending on a third-party orchestration tool.

It has a straightforward installation process, is lightweight, and is easy to integrate if you’re already accustomed to the Docker ecosystem.

The core component of Docker is Docker Engine, which hosts its containers. Docker Engine runs on the host OS and interacts with containers to access system resources.

Docker also uses YAML configuration files that specify how to build a container and what runs inside it. This is one reason why Docker is portable and easy to troubleshoot.

Docker Swarm is a great option when working with a few nodes and relatively simple applications. However, if you’re orchestrating large nodes for critical applications, you would benefit more from Kubernetes’s security features, constant monitoring, flexibility, and resilience.

Kubernetes provides

Compute scheduling: It considers the resource needs of your containers, to find the right place to run them automatically.

Self-healing: If a container crashes, a new one will be created to replace it.

Horizontal scaling: By observing CPU or custom metrics, Kubernetes can add and remove instances as needed.
Volume management—It manages the persistent storage used by your applications.

Service discovery & load balancing: IP address, DNS, and multiple instances are load-balanced.

Automated rollouts & rollbacks: During updates, the health of your new instances are monitored, and if a failure occurs, it can roll back to the previous version automatically.
Secret & configuration management. It manages application configuration and secrets.

Kubernetes uses a master/slave communication model where there is at least one master and usually several worker nodes.

API server: Exposes the Kubernetes API for controlling the cluster

Controller manager: Responsible for watching the cluster’s objects and resources and ensuring the desired state is consistent.

Scheduler: Responsible for scheduling compute requests on the cluster.

etcd: An open-source distributed key value store used to hold the cluster data.

The worker nodes provide the container runtime for your applications and have a few components responsible for communicating with the master and networking on every worker node.

Kubelet: Responsible for communicating to the master and ensuring the containers are running on the node.

Kube-proxy: Enables the cluster to forward traffic to executing containers.

Docker (container runtime): Provides the runtime environment for containers.

To run an application on Kubernetes, you need to communicate with the API server using the object model.

Pod: A group of one or more containers and metadata.

Service: Works with a set of pods and directs traffic to them.

Deployment: Ensures the desired state and scale are maintained.

I ❤️ building dashboards for my customers

I ❤️ building dashboards for my customers

Said nobody, ever. Embeddable's dashboard toolkit is built to save dev time. It loads fast, looks native and doesn't suck like an embedded BI tool.

Get early access

Top comments (0)

Sentry image

Tutorial: Debugging with Cursor + Sentry MCP

No more copying and pasting error messages, logs, or trying to describe your distributed tracing setup or stack traces in chat. MCP can investigate real issues, understand their impact, and suggest fixes based on the actual production context.

👀 See how →

Announcing the First DEV Education Track: "Build Apps with Google AI Studio"

The moment is here! We recently announced DEV Education Tracks, our new initiative to bring you structured learning paths directly from industry experts.

Dive in and Learn

DEV is bringing Education Tracks to the community. Dismiss if you're not interested. ❤️