This repository contains the source code and Kubernetes deployment configurations for a simple Node.js application. This project demonstrates a GitOps workflow using ArgoCD to manage deployments automatically in a Kubernetes cluster.
The Node.js application is a simple web server that is containerized with Docker and deployed to a Kubernetes cluster. The deployment process is managed through ArgoCD, which continuously monitors this repository for changes and applies them to the cluster based on the GitOps principles.
Before you start, ensure you have the following installed:
- Docker
- Kubernetes
- kubectl
- ArgoCD CLI
To run the Node.js application locally, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/your-repo.git cd your-repo
-
Install dependencies:
npm install
-
Start the application:
npm start
This will start the Node.js server on
http://localhost:3000
.
The application is Dockerized with a Dockerfile in the root of the repository. To build the Docker image, run:
docker build -t your-username/your-app:latest .
To run the application using Docker:
docker run -p 3000:3000 your-username/your-app:latest
The Kubernetes manifests in the deployments/
directory define the necessary resources for deploying this application to a Kubernetes cluster.
-
Applying Kubernetes Manifests Manually (not recommended for GitOps workflow):
kubectl apply -f deployments/
-
Using ArgoCD:
- Set up ArgoCD in your cluster.
- Create an application in ArgoCD that tracks this repository.
- Make changes to the manifests or Docker image, push them to your repository, and watch ArgoCD automatically synchronize the changes.
You can monitor and manage the application through the ArgoCD dashboard:
-
Access the Dashboard: Forward the ArgoCD server port to your local machine:
kubectl port-forward svc/argocd-server -n argocd 8080:443
Then visit
https://localhost:8080
in your browser. -
Login Details: Use the default username
admin
and get the password using:kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 --decode; echo
-
View the Application Status: Check the sync status, health, and more in the ArgoCD dashboard.
Contributions are welcome! Feel free to open pull requests or issues to improve the application or deployment configurations.
This project is licensed under the MIT License - see the LICENSE file for details.
- Customization: You may need to replace placeholders (like
your-username/your-repo
) with actual values relevant to your project. - Repository Links: Adjust links to match the actual URLs where your code and Docker images are hosted.
- ArgoCD Configuration Details: This README assumes ArgoCD is already configured and operational within the cluster. If this is not the case, you might need to include setup details or refer to official ArgoCD documentation for initial setup instructions.
This README.md provides a comprehensive guide that not only helps users understand how to get the application running but also how to manage deployments through a GitOps workflow using ArgoCD.
-**The End