Kubernetes - pranavkumarpk01/MD-DevOps GitHub Wiki
Kubernetes Overview
What is Kubernetes?
Kubernetes is an open-source container orchestration platform designed to automate the deployment, scaling, and operation of containerized applications. It was originally developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF). Kubernetes enables developers to manage containerized workloads efficiently across a cluster of machines.
Difference Between Docker Swarm and Kubernetes
1. Overview
- Docker Swarm: A native clustering and orchestration tool for Docker containers.
- Kubernetes: An open-source container orchestration platform for managing containerized applications across multiple hosts.
2. Key Differences
Feature | Docker Swarm | Kubernetes |
---|
| Scalability | Less automated scaling | Highly automated, supports auto-scaling |
| Service Discovery | Built-in via DNS | Uses CoreDNS for advanced discovery |
| Rolling Updates | Supports rolling updates but lacks advanced rollback | Provides rolling updates with rollback options |
| Security | Basic security features | Strong RBAC and namespace-based security |
3. Advantages of Kubernetes Over Docker Swarm
- Better Scalability: Kubernetes scales applications automatically based on demand.
- Higher Availability: Ensures zero downtime with multi-master architecture.
- Better Security: Implements Role-Based Access Control (RBAC) for secure access.
4. Conclusion
- Choose Docker Swarm if you need a lightweight, easy-to-deploy container orchestration tool for small-scale applications.
- Choose Kubernetes if you require advanced orchestration, scalability, and robust security for enterprise-grade applications.
Features of Kubernetes
- Automated Deployment and Scaling: Kubernetes automates the deployment and scaling of applications based on demand.
- Self-Healing: Automatically restarts failed containers and replaces unresponsive nodes.
- Load Balancing: Distributes traffic among multiple instances of an application to ensure high availability.
- Rollouts and Rollbacks: Enables controlled updates and rollbacks of applications.
- Multi-Cloud and Hybrid Deployment: Can run on-premises, in public clouds, or in hybrid environments.
Kubernetes Architecture
Kubernetes follows a master-worker node architecture. It consists of the following components:
1. Master Node (Control Plane)
The master node manages the Kubernetes cluster and contains the following components:
- API Server: Acts as the communication hub for all Kubernetes components and exposes the Kubernetes API.
- Controller Manager: Monitors the cluster state and ensures that the desired state matches the current state.
- Scheduler: Assigns workloads to worker nodes based on resource availability.
- etcd: A distributed key-value store that maintains cluster configuration and state information.
2. Worker Nodes
Worker nodes run containerized applications and include:
- Kubelet: An agent that runs on each worker node, communicating with the API server and managing containers.
- Container Runtime: A software component (e.g., Docker, containerd) responsible for running containers.
- Kube Proxy: Handles network communication between services within the cluster.
- Pods: The smallest deployable unit in Kubernetes, containing one or more containers.