Level Up Coding

Coding tutorials and news. The developer homepage gitconnected.com && skilled.dev && levelup.dev

Follow publication

Member-only story

Understanding Kubernetes: A Beginner’s Guide to Container Orchestration

AK
Level Up Coding
Published in
3 min readDec 2, 2024

Have you ever wondered how companies like Netflix or Spotify manage thousands of containers across multiple servers? Kubernetes is the answer. In this guide, we’ll break down Kubernetes concepts into simple terms and show you how to get started with practical examples.

What is Kubernetes?

Think of Kubernetes like a highly efficient restaurant manager. Just as a manager coordinates kitchen staff, tables, and food delivery, Kubernetes coordinates containers, servers, and applications. Let’s see how it works in practice.

Your First Kubernetes Configuration

Let’s start with a simple web application deployment:

# my-first-app.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
labels:
app: hello-world
spec:
replicas: 3 # We want three copies of our application
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-app
image: nginx:latest
ports:
- containerPort: 80
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"

Let’s break this down into simpler terms:

  • Think of Deployment as a blueprint for your application
  • replicas: 3 means "keep three copies running at all times"
  • resources specifies how much CPU and memory each copy needs

Creating a Service

Now that our application is running, let’s make it accessible:

# hello-service.yaml
apiVersion: v1
kind: Service
metadata:
name: hello-service
spec:
selector:
app: hello-world
ports:
- port: 80
targetPort: 80
type: LoadBalancer

This is like setting up the front desk of our restaurant:

  • The Service acts as the host/hostess
  • It directs traffic to our application instances
  • LoadBalancer means it can accept external traffic

Understanding Pods and Containers

Let’s create a more complex application with multiple containers:

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Written by AK

Software engineer by day, problem-solver always. Writing about tech, productivity & life lessons. Building tomorrow's solutions while sharing today's insights.

No responses yet

Write a response