.. | ||
k8s | ||
src | ||
.gitignore | ||
Dockerfile | ||
package.json | ||
prepare-app.sh | ||
README.md | ||
remove-app.sh |
Contact List Application
A simple web-based contact list application deployed on Google Kubernetes Engine (GKE) with automated HTTPS certificate provisioning.
Description
This application allows users to create, view, update, and delete contacts in a persistent MongoDB database. It features a clean, responsive interface and is deployed as a containerized application on Google Cloud Platform using Kubernetes.
Technologies Used
- Frontend: HTML, CSS, JavaScript
- Backend: Node.js with Express
- Database: MongoDB
- Containerization: Docker
- Orchestration: Google Kubernetes Engine (GKE)
- Load Balancing & HTTPS: GKE Ingress with Google-managed certificates
- Domain: Dynamic domain using nip.io DNS service
Architecture
The application consists of multiple containers:
- Contact App: Node.js application serving the web interface and API
- MongoDB: NoSQL database for storing contact information
- Ingress Controller: Manages external access to the services
- Load Balancer: Distributes incoming traffic
Key Features
- Responsive web interface
- RESTful API for contact management
- Persistent data storage using MongoDB with PersistentVolumeClaims
- Automatic HTTPS certificate provisioning
- Automatic application restart on failure
- Scalable architecture
Deployment Files
The application includes the following configuration files:
- Dockerfile: Containerizes the Node.js application
- k8s/: Kubernetes configuration directory
- app-deployment.yaml: Deployment for the Node.js application
- app-service.yaml: Service for the Node.js application
- contact-app-lb.yaml: LoadBalancer service for obtaining external IP
- ingress.yaml: Template for Ingress configuration
- mongo-deployment.yaml: Deployment for MongoDB
- mongo-service.yaml: Service for MongoDB
- mongo-pvc.yaml: PersistentVolumeClaim for MongoDB data
- namespace.yaml: Namespace for application resources
Deployment Scripts
prepare-app.sh
This script handles the entire deployment process:
- Builds and pushes the Docker image to Google Container Registry
- Creates a GKE cluster if one doesn't exist
- Deploys MongoDB with persistent storage
- Deploys the Contact App application
- Creates a LoadBalancer service to obtain an external IP
- Configures Ingress with a dynamic domain using nip.io
- Sets up HTTPS with Google-managed certificates
remove-app.sh
This script removes all resources created by the application:
- Deletes Ingress and certificates
- Deletes application deployments and services
- Deletes MongoDB deployment, service, and PVC
- Removes the Kubernetes namespace
Usage Instructions
you can access the website here: https://34.54.83.94.nip.io
Prerequisites
- Google Cloud Platform account with billing enabled
- Google Cloud SDK installed and configured
- kubectl installed
- Docker installed
Deployment
- Clone the repository
- Navigate to the project directory
- Make the scripts executable:
chmod +x prepare-app.sh remove-app.sh