This project demonstrates a simple CI/CD pipeline using Kubernetes (k8s) and Argo Workflows. It deploys a basic Node.js application to a Kubernetes cluster using Argo Workflows for orchestration.
- Docker installed and configured
- Kubernetes CLI (kubectl) installed
- Minikube, Kind, or another local Kubernetes solution
- Git
git clone <your-repo-url>
cd k8s-argo-demoRun the setup script to create a local Kubernetes cluster and install Argo Workflows:
chmod +x scripts/setup.sh
./scripts/setup.shThis script:
- Starts a Minikube cluster
- Installs Argo Workflows
- Sets up port forwarding to access the Argo UI
Replace ${YOUR_DOCKER_USERNAME} in the Kubernetes manifests and Argo Workflow template with your Docker Hub username:
cd app
docker build -t yourusername/k8s-argo-demo:latest .
docker push yourusername/k8s-argo-demo:latestApply the Kubernetes manifests:
kubectl apply -f kubernetes/manifests.yamlCheck that your application is running:
kubectl get pods -n demo-appSubmit the workflow to Argo:
kubectl apply -f argo/workflow.yamlkubectl port-forward -n demo-app svc/demo-app-service 8080:80Then open http://localhost:8080 in your browser.
app/: Contains the Node.js application code and Dockerfilekubernetes/: Contains Kubernetes deployment manifestsargo/: Contains Argo Workflow templatesscripts/: Contains setup and utility scripts
- Setting up a local Kubernetes cluster
- Creating a basic containerized application
- Writing Kubernetes deployment manifests
- Understanding Kubernetes namespaces, deployments, services, and ingress
- Creating and running Argo Workflows
- Implementing a simple CI/CD pipeline
Once you're comfortable with this basic setup, you can:
- Add automated testing to your workflow
- Implement environment-specific deployments (dev, staging, prod)
- Add Argo CD for GitOps-style continuous delivery
- Explore Argo Events for event-driven workflows
- Implement rollback mechanisms for failed deployments
- If you encounter issues with Docker socket permissions in Argo Workflows, make sure you've mounted the Docker socket correctly and have the necessary permissions.
- For Minikube, you might need to run
eval $(minikube docker-env)to use the Minikube Docker daemon. - If your ingress is not working, make sure you have an ingress controller installed in your cluster.