This project demonstrates the implementation of a Kubernetes ReplicaSet to manage and maintain a specified number of NGINX pod replicas. Through this implementation, I've showcased the power of Kubernetes' self-healing capabilities and automated pod management, ensuring high availability and reliability in containerized environments.
- Deploy and manage a ReplicaSet in Kubernetes to maintain multiple NGINX pod replicas
- Implement self-healing mechanisms using Kubernetes' automated pod regeneration
- Configure proper pod labeling and selector matching for effective replica management
- Demonstrate pod lifecycle management and automatic recovery scenarios
- Practice industry-standard deployment configurations and best practices
The architecture illustrates a Kubernetes ReplicaSet Controller managing three identical pods. Each pod runs an NGINX container, with the ReplicaSet ensuring exactly three replicas are maintained at all times. The controller continuously monitors these pods and automatically replaces any that fail or are deleted, maintaining the desired state of three running NGINX instances.
graph TD
A[ReplicaSet Controller] -->|Manages| B[Pod 1]
A -->|Manages| C[Pod 2]
A -->|Manages| D[Pod 3]
B -->|Runs| E[NGINX Container]
C -->|Runs| F[NGINX Container]
D -->|Runs| G[NGINX Container]
- Container Orchestration: Kubernetes
- Container Runtime: Docker
- Web Server: NGINX
- Container Image: nginx:latest
- Infrastructure: Kubernetes Cluster
- Configuration: YAML
🐳 Prerequisites
- Kubernetes cluster (local or cloud-based)
- kubectl CLI tool installed and configured
- Basic understanding of Kubernetes concepts
- Docker installed (for local development)
- vim text editor (optional)
⚙️ Installation
- Clone the repository:
git clone https://github.com/TheToriqul/k8s-replicaset.git
- Navigate to the project directory:
cd k8s-replicaset
- Apply the ReplicaSet configuration:
kubectl apply -f replicaset.yaml
🎮 Usage
- Deploy the ReplicaSet:
kubectl apply -f replicaset.yaml
- Verify the deployment:
kubectl get replicasets kubectl get pods --selector=app=nginx
For detailed commands and testing scenarios, refer to the reference-commands.md file.
- Advanced understanding of Kubernetes ReplicaSet controllers
- Pod lifecycle management and automatic recovery mechanisms
- Label-based pod selection and management
- YAML-based Kubernetes configuration
- Container orchestration best practices
- Infrastructure automation and self-healing systems
- High availability design patterns
- Container management strategies
- DevOps practices and tooling
- System reliability engineering principles
View Planned Improvements
- Implement rolling updates strategy
- Add health check mechanisms
- Configure resource limits and requests
- Implement horizontal pod autoscaling
- Add monitoring and logging solutions
- Implement network policies
Contributions are welcome! Feel free to open an issue or submit a pull request to suggest improvements or add features.
- 📧 Email: toriqul.int@gmail.com
- 📱 Phone: +65 8936 7705, +8801765 939006
- 🌐 LinkedIn: @TheToriqul
- 🐙 GitHub: @TheToriqul
- 🌍 Portfolio: TheToriqul.com
Let's connect and discuss cloud-native technologies!
- Poridhi for providing comprehensive labs and inspiring this project
- The Kubernetes community for excellent documentation and resources
- NGINX team for maintaining the official Docker image
Thank you for exploring this repository! I hope you find it valuable for understanding Kubernetes ReplicaSets and container orchestration concepts. Happy containerizing! 🚀