Kubernetes Overview and Key Concepts

Sep 24, 2024

Kubernetes Overview

Definition of Kubernetes

  • Kubernetes: An open-source container orchestration framework developed by Google.
  • Purpose: Manages applications made up of multiple containers across various environments (physical, virtual, cloud, hybrid).

Problem Solution Case Study

  • Context: Rise of microservices increased the use of container technologies.
  • Challenges: Managing hundreds or thousands of containers across environments using scripts/tools is complex.
  • Need for Orchestration: Ensures high availability, scalability, and disaster recovery for applications.

Features of Container Orchestration Tools

  1. High Availability: No downtime; applications are always accessible.
  2. Scalability: High performance; quick load times and response rates.
  3. Disaster Recovery: Mechanism to recover from data loss or infrastructure failures using snapshots of the current state.

Kubernetes Architecture

  • Cluster Composition: Comprised of at least one master node and multiple worker nodes.

Master Node

  • Key Processes:
    • API Server: Entry point for Kubernetes clients (UI, scripts, command line).
    • Controller Manager: Manages cluster state, repairs, and restarts containers as needed.
    • Scheduler: Allocates containers to worker nodes based on resource availability and workload.
    • Etcd: Key-value store holding the current state and configuration data of the cluster. Important for backups and recovery.
    • Virtual Network: Connects all nodes in the cluster, functioning as a single machine with combined resources.

Worker Nodes

  • Run application containers and execute tasks.
  • Typically larger and more resource-rich due to workload.

Kubernetes Basic Concepts

Pods

  • Pod: Smallest unit configured and interacted with by Kubernetes users; acts as a wrapper for one or more containers.
    • Typically, one pod per application (e.g., database, server).
    • Each pod receives its own IP address for internal communication.
    • Pods are ephemeral; they can frequently restart, leading to new pods with new IPs.

Services

  • Service: Static IP and load balancer for pods to facilitate communication between them, addressing the problem of changing IPs due to pod restarts.

Configuration of Kubernetes Components

  • API Server: Main entry point where configurations are sent (in YAML or JSON format).
  • Example Configuration:
    • Configuration defines a deployment template for creating pods.
    • Uses declarative form to specify desired states (e.g., number of replicas, environment variables).

Summary of Kubernetes Configuration Process

  • Kubernetes attempts to match the desired state defined in configurations with the actual state in the cluster.
  • If discrepancies arise (e.g., a pod dies), the controller manager ensures the desired state is restored automatically.

Conclusion

  • The lecture provided an overview of Kubernetes, its architecture, key components, and basic concepts.
  • Encouragement to engage with the content (like, subscribe, ask questions).