MQL5-Google-Onedrive/docs/KUBERNETES_INTRODUCTION.md
Copilot 655fa623fc
Add Kubernetes introduction documentation (#251)
* Initial plan

* Add comprehensive Kubernetes introduction guide

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
2026-02-05 02:53:41 +07:00

4.9 KiB

Introduction to Kubernetes

Kubernetes, often abbreviated as K8s, is an open-source container orchestration platform designed to automate the deployment, scaling, and management of containerized applications. Developed by Google and donated to the Cloud Native Computing Foundation (CNCF), Kubernetes has become a cornerstone of modern cloud-native application deployment.


Why Kubernetes?

  1. Scalability:
    • Automatically scale applications up or down based on load.
  2. Flexibility:
    • Works across multiple cloud providers, on-premises, or hybrid environments.
  3. High Availability:
    • Built-in capabilities for self-healing, rolling updates, and maintaining application uptime.
  4. Container Orchestration:
    • Simplifies managing a large number of containers, ensuring they run reliably.

Key Concepts of Kubernetes

  1. Cluster:

    • A Kubernetes cluster consists of:
      • Control Plane: Manages the cluster, schedules workloads, monitors state.
      • Worker Nodes: Machines where application workloads (containers) run.
  2. Pods:

    • The smallest deployable unit in Kubernetes.
    • Encapsulates one or more containers, their storage, and configuration.
  3. Nodes:

    • Physical or virtual machines where workloads (Pods) are executed.
  4. Services:

    • Provides a permanent entry point (IP address or DNS) to access Pods.
    • Abstracts load balancing between Pods.
  5. Deployment:

    • A higher-level abstraction for managing Pods.
    • Handles rolling updates and scaling of applications automatically.
  6. ConfigMaps and Secrets:

    • Mechanisms for storing non-sensitive (ConfigMaps) and sensitive (Secrets) configuration data.
  7. Namespaces:

    • Logical partitions for isolating resources within the same cluster.

Features of Kubernetes

  • Load Balancing & Service Discovery

    • Automatically exposes services via DNS names or IP addresses.
    • Handles distributing traffic between healthy Pods.
  • Self-Healing:

    • Replaces failed containers automatically and reschedules workloads if necessary.
  • Horizontal & Vertical Scaling:

    • Scales applications horizontally (by adding Pods) or adjusts resources like CPU/memory for existing Pods.
  • Automated Rollouts & Rollbacks:

    • Deploy new application updates incrementally and revert if errors occur.
  • Storage Orchestration:

    • Automatically mounts storage systems like AWS EBS, Azure Disks, or local storage as required.
  • Multi-Cloud Support:

    • Runs seamlessly across on-premise data centers, public clouds, or hybrid cloud setups.

How Kubernetes Works: Simplified Workflow

  1. Cluster Setup:

    • Kubernetes runs on a group of machines (Control Plane & Worker Nodes).
  2. Deploy Application:

    • Define application configuration using .yaml or .json manifest files, specifying Pods, deployments, services, etc.
  3. Scheduler:

    • Kubernetes schedules Pods to available nodes in the cluster.
  4. Controller Logic:

    • Ensures the cluster maintains the desired state (e.g., specified application replicas running).
  5. Service Discovery & Networking:

    • Kubernetes enables intra-cluster communication via DNS and provides external access to applications.
  6. Scaling & Recovery:

    • Monitors application performance, scales replicas automatically, and recreates Pods in case of failures.

Getting Started with Kubernetes

To begin using Kubernetes, you'll need:

  1. A Kubernetes Distribution:

    • Examples: Minikube (local testing), Amazon EKS, Microsoft AKS, Google GKE, or OpenShift.
  2. kubectl:

    • Command-line client to interact with and manage your Kubernetes cluster.
  3. Container Images:

    • Applications packaged as container images (e.g., Docker images).
  4. Manifest Files:

    • Write YAML files defining your applications, deployments, and services.

Example: Kubernetes Manifest for a Simple Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.21
        ports:
        - containerPort: 80
  • Deploys 3 replicas of an Nginx container across your cluster.

Official Resources for Learning More

Let me know if you want to dive deeper into any specific aspect of Kubernetes, like CI/CD integration, monitoring, or advanced networking!