Comprehensive Notes on Kubernetes Concepts

Aug 19, 2024

Complete Kubernetes Course Notes

Course Overview

  • Mix of theoretical explanations and hands-on demos.
  • Topics covered:
    • Introduction to Kubernetes
    • Installation of Minikube for local clusters
    • Kubernetes command line tool: kubectl
    • YAML configuration files for Kubernetes
    • Deployment of applications in Kubernetes
    • Advanced concepts such as namespaces, Ingress, and Helm.

Introduction to Kubernetes

  • Definition: Open-source container orchestration framework developed by Google.
  • Purpose: Manages applications made up of many containers across various environments.
  • Key Features:
    • High availability
    • Scalability
    • Disaster recovery

Core Concepts

  1. Pods:

    • Basic unit of Kubernetes, represents a single instance of a running process in a cluster.
    • Can run multiple containers but typically hosts one main application container.
  2. Services:

    • Expose applications running on a set of Pods as a network service.
    • Types of services: ClusterIP, NodePort, LoadBalancer, Headless.
  3. Deployments:

    • A method for managing the deployment of Pods.
    • Allows scaling, updating, and maintaining Pods.
  4. ConfigMaps and Secrets:

    • External configuration and sensitive data storage.
    • ConfigMaps store non-sensitive data, Secrets store sensitive data (e.g., passwords).
  5. Volumes:

    • Used to persist data across Pod restarts.
    • Types include Persistent Volumes and Persistent Volume Claims.
    • Data can be stored in local or remote storage.

Advanced Concepts

  • Namespaces: Logical partitions in a Kubernetes cluster to organize resources.
  • Ingress: Manages external access to services in a cluster, providing HTTP routing.
  • Helm: Package manager for Kubernetes; allows easy deployment of applications using charts.

Kubernetes Architecture

  • Master Node: Controls the cluster, schedules Pods, and manages the cluster state.
  • Worker Node: Hosts the Pods that run the applications.
  • Components: Kubelet, Kube-proxy, API server, Scheduler, Controller Manager, etcd.

Services in Depth

  1. ClusterIP: Default service type, only accessible from within the cluster.
  2. NodePort: Exposes the service on each node's IP at a static port.
  3. LoadBalancer: Creates an external load balancer in supported cloud providers.
  4. Headless Services: Allows direct access to Pod IPs, useful for stateful applications.

Persistent Storage

  • Persistent Volume (PV): Represents a piece of storage in the cluster.
  • Persistent Volume Claim (PVC): User's request for storage.
  • Storage Classes: Define different types of storage and provision them dynamically.

Stateful Sets

  • Used for deploying stateful applications (e.g., databases).
  • Each Pod has a unique identity and stable storage.
  • Pods are created and deleted in a specific order to maintain consistency.

Conclusion

  • Kubernetes provides powerful abstractions for managing containerized applications.
  • Understanding the core components and their interactions is essential for effective Kubernetes usage.