MODULE 1 - Introduction to Kubernetes
Overview
This first module introduces you to Kubernetes, the most widely used container orchestration platform in the world. You will discover why Kubernetes exists, how it works at a high level, and what fundamental concepts you will use throughout this course.
Learning Objectives
By the end of this module, you will be able to:
- Explain what Kubernetes is and why it is essential
- Understand the evolution from containerization to orchestration
- Identify the main components of a Kubernetes cluster
- Distinguish the Control Plane from the Worker Nodes
- Use kubectl to interact with a cluster
- Start a local cluster for practice
Estimated Duration
Theory: 3-4 hours
Practice: 2-3 hours
Total: 5-7 hours
Table of Contents
Part 1: Introduction and Concepts
- Chapter 1.1 - What is Kubernetes?
- Chapter 1.2 - Why Kubernetes?
- Chapter 1.3 - History and Evolution
- Chapter 1.4 - High-Level Architecture
- Chapter 1.5 - Fundamental Concepts
Part 2: Installation and Practice
Practical Labs
Validation
What is Kubernetes?
Kubernetes (often abbreviated as K8s) is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications.
Simple Definition
Imagine you have several applications (microservices) that need to:
- Run on multiple servers
- Be automatically restarted if they crash
- Be scaled according to load
- Communicate reliably with each other
Kubernetes does all of this automatically for you.
Analogy: The Conductor
Like a conductor coordinates musicians, Kubernetes coordinates your containers to work together harmoniously.
Key Features
Kubernetes offers:
-
Automatic Orchestration
- Automatic deployment and restarts
- Distribution of containers across available machines
- Application lifecycle management
-
Scaling
- Automatic increase/decrease of the number of instances
- Adaptation to workload
- Resource usage optimization
-
Self-Healing
- Automatic restart of crashed containers
- Replacement of failing containers
- Redistribution in case of machine failure
-
Service Discovery
- Automatic communication between services
- Integrated load balancing
- Internal DNS management
-
Configuration Management
- Centralized configuration storage
- Secure management of secrets
- Declarative deployments
Why Kubernetes?
Challenges Without Kubernetes
Before Kubernetes, deploying containerized applications was complex:
Problems:
- Manual container management
- No automatic restart
- Complex and manual scaling
- No integrated load balancing
- Dispersed configuration management
- No service discovery
Advantages With Kubernetes
Advantages:
- Complete automatic orchestration
- Self-healing and high availability
- Horizontal and vertical scaling
- Integrated load balancing
- Automatic service discovery
- Centralized configuration management
Typical Use Cases
Kubernetes is ideal for:
-
Microservices
- Applications composed of many small services
- Inter-service communication
- Independent deployment of each service
-
Cloud-Native Applications
- Applications designed for the cloud
- Automatic scalability
- Resilience and self-healing
-
DevOps and CI/CD
- Automated deployments
- Easy rollback in case of issues
- Multiple environments (dev, staging, prod)
-
Multi-cloud and Hybrid Cloud
- Deployment across multiple clouds
- Portability between environments
- Avoiding vendor lock-in
History and Evolution
The Evolution of Containerization
Google and Borg
Kubernetes was created by Google, which internally used a system called Borg to orchestrate millions of containers.
Borg (2003-2015):
- Google's proprietary system
- Managed hundreds of thousands of jobs
- Basis of experience for Kubernetes
Kubernetes (2014):
- Open-source version inspired by Borg
- Named after the Greek word "κυβερνήτης" (pilot, helm)
- K8s = K + 8 letters + s
Adoption and Growth
Key Figures:
- Used by millions of organizations
- Over 100,000 GitHub commits
- Over 3,000 contributors
- Adopted by all major tech companies
High-Level Architecture
Cluster Overview
A Kubernetes cluster is composed of two types of machines:
Control Plane (Master)
The Control Plane is the "brain" of the cluster. It makes all decisions and manages the cluster's state.
Control Plane Components:
-
API Server
- Single entry point for all interactions
- Validates and processes requests
- Exposes the Kubernetes REST API
-
etcd
- Distributed database
- Stores the cluster's state
- Single source of truth
-
Controller Manager
- Runs control loops
- Monitors desired state vs actual state
- Takes corrective actions
-
Scheduler
- Decides on which node to place new pods
- Considers resources and constraints
- Optimizes distribution
Worker Nodes
Worker Nodes run the applications. Each node contains:
Worker Node Components:
-
kubelet
- Agent that communicates with the API Server
- Manages pods on the node
- Monitors container health
-
kube-proxy
- Manages networking at the node level
- Implements Services (load balancing)
- Manages network rules
-
Container Runtime
- Runs containers (Docker, containerd, CRI-O)
- Manages images and containers
- Standardized interface (CRI)
Fundamental Concepts
Pods
A Pod is the smallest deployable unit in Kubernetes. It is a group of one or more containers that share resources.
Characteristics:
- One Pod = one or more containers
- Containers in a Pod share:
- The IP address
- The volumes
- The network namespace
- Pods are ephemeral (can be recreated)
Deployments
A Deployment describes the desired state of your application (how many replicas, which image, etc.).
Features:
- Replica management (number of instances)
- Rolling updates (non-disruptive updates)
- Rollback in case of issues
- Self-healing
Services
A Service exposes a set of Pods as a stable network service.
Service Types:
- ClusterIP: Internal cluster service
- NodePort: Exposes on a port of each node
- LoadBalancer: Exposes via a cloud load balancer
- ExternalName: Alias to an external service
Namespaces
Namespaces allow you to divide a cluster into multiple virtual environments.
Advantages:
- Logical isolation
- Separation of environments
- Resource quota management
- Access control (RBAC)
Kubernetes Ecosystem
Kubernetes is not alone. It is part of a rich ecosystem of tools and projects.
CNCF Projects
The Cloud Native Computing Foundation (CNCF) hosts many projects related to Kubernetes:
- Kubernetes: Orchestration
- Prometheus: Monitoring
- Helm: Package management
- Istio: Service mesh
- Fluentd: Logging
- etcd: Distributed storage
- And many more...
Module Summary
In this module, you learned:
Kubernetes is a container orchestration platform
It automates the deployment, scaling, and management of applications
A cluster is composed of a Control Plane and Worker Nodes
Pods are the smallest deployable unit
Deployments manage the application lifecycle
Services expose applications in a stable manner
Namespaces allow logical isolation
Next Steps
Now that you understand the basic concepts, you are ready for:
Module 2: Detailed architecture and Kubernetes components
Module 3: Pods and Deployments in practice
Additional Resources
Module created on: December 2024