CLOUD
Guides

Kubernetes for Beginners: What It Is and When You Need It

CLOUD|January 22, 2026|4 min read|478 views
Kubernetes for Beginners: What It Is and When You Need It

Kubernetes manages containers at scale. But not for everyone. We explain the concept and when it is the right solution — and when Docker Compose is enough.

What is Kubernetes?

Kubernetes (abbreviated K8s) is an open-source system for automatic container management. Developed by Google, it became an independent project under the CNCF foundation. If Docker builds and runs a single container, Kubernetes manages dozens or hundreds of containers — distributing them across servers, restarting them on failure, and scaling them under load.

When do you need Kubernetes?

  • Your application consists of multiple microservices
  • You need automatic scaling based on load
  • You need zero-downtime deployment
  • You manage more than 10 containers

When do you not need it?

  • A simple single application — Docker Compose is sufficient
  • A small team without infrastructure management experience
  • Limited budget — Kubernetes requires additional resources for the Control Plane

Core Components

The Cluster

┌─────────────────────────────────────────────┐
│ Cluster │
│ │
│ ┌──────────────────────┐ │
│ │ Control Plane │ │
│ │ ┌─────────────────┐ │ │
│ │ │ API Server │ │ │
│ │ │ Scheduler │ │ │
│ │ │ Controller Mgr │ │ │
│ │ │ etcd │ │ │
│ │ └─────────────────┘ │ │
│ └──────────────────────┘ │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Node 1 │ │ Node 2 │ │ Node 3 │ │
│ │ ┌──────┐ │ │ ┌──────┐ │ │ ┌──────┐ │ │
│ │ │ Pod │ │ │ │ Pod │ │ │ │ Pod │ │ │
│ │ │ Pod │ │ │ │ Pod │ │ │ │ Pod │ │ │
│ │ └──────┘ │ │ └──────┘ │ │ └──────┘ │ │
│ └──────────┘ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────┘

Key Terminology

Term Description
Cluster The set of servers managed by Kubernetes
Node A single server within the Cluster
Pod The smallest unit — one or more containers running together
Deployment Describes how many Pods you want and how they run
Service Provides a stable address to reach a group of Pods
Namespace A logical partition within the Cluster
ConfigMap Application settings (non-sensitive)
Secret Encrypted sensitive data (passwords, keys)

Setting Up a Local Development Environment

minikube (for learning and experimentation)

# Install on Linux
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

# Start a local Cluster
minikube start --driver=docker

# Verify
kubectl cluster-info
kubectl get nodes

kubectl (command-line tool)

# Install
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install kubectl /usr/local/bin/kubectl

# Verify
kubectl version --client

First Deployment

Deployment File

# File: deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
 name: my-app
 labels:
 app: my-app
spec:
 replicas: 3
 selector:
 matchLabels:
 app: my-app
 template:
 metadata:
 labels:
 app: my-app
 spec:
 containers:
 - name: app
 image: my-laravel-app:1.0
 ports:
 - containerPort: 9000
 resources:
 requests:
 memory: "256Mi"
 cpu: "250m"
 limits:
 memory: "512Mi"
 cpu: "500m"
 env:
 - name: APP_ENV
 value: "production"
 - name: DB_HOST
 valueFrom:
 configMapKeyRef:
 name: app-config
 key: db-host

Service File

# File: service.yaml
apiVersion: v1
kind: Service
metadata:
 name: my-app-service
spec:
 selector:
 app: my-app
 ports:
 - protocol: TCP
 port: 80
 targetPort: 9000
 type: LoadBalancer

Applying

# Deploy the application
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml

# View status
kubectl get deployments
kubectl get pods
kubectl get services

# Details of a specific Pod
kubectl describe pod my-app-xxxxx

# Pod logs
kubectl logs my-app-xxxxx
kubectl logs -f my-app-xxxxx # follow in real-time

ConfigMaps and Secrets

# File: configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
 name: app-config
data:
 db-host: "mysql-service"
 cache-driver: "redis"
 app-url: "https://example.com"
# Create a Secret
kubectl create secret generic app-secrets \
 --from-literal=db-password=my_secure_password \
 --from-literal=redis-password=redis_secure_pass

# Or from a file
kubectl create secret generic app-secrets --from-file=.env

Scaling

# Manual scaling
kubectl scale deployment my-app --replicas=5

# Auto-scaling based on CPU usage
kubectl autoscale deployment my-app --min=2 --max=10 --cpu-percent=70

HorizontalPodAutoscaler File

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
 name: my-app-hpa
spec:
 scaleTargetRef:
 apiVersion: apps/v1
 kind: Deployment
 name: my-app
 minReplicas: 2
 maxReplicas: 10
 metrics:
 - type: Resource
 resource:
 name: cpu
 target:
 type: Utilization
 averageUtilization: 70

Updates and Rollbacks

# Update application image
kubectl set image deployment/my-app app=my-laravel-app:2.0

# Monitor update status
kubectl rollout status deployment/my-app

# Rollback the last update
kubectl rollout undo deployment/my-app

# View update history
kubectl rollout history deployment/my-app

Useful Commands

# Enter a Pod
kubectl exec -it my-app-xxxxx -- bash

# Copy file from/to a Pod
kubectl cp my-app-xxxxx:/var/log/app.log ./app.log

# View events
kubectl get events --sort-by=.metadata.creationTimestamp

# Delete all resources from a file
kubectl delete -f deployment.yaml

Kubernetes and CLOUD

To run Kubernetes in production, you need at least 3 servers — one for the Control Plane and two as Workers. With CLOUD (cloud.net.sa), you can order multiple VPS instances in Riyadh with fast internal networking and build your own Cluster entirely.

Start with minikube on a development server from CLOUD and learn the basics, then expand to a full Cluster when your application demands it.


Get Started

Ready to build your project? Configure your cloud server with the specs your app needs, or view plans and pricing.

Share