# Calculator Web Application on Azure Kubernetes Service (AKS) --- ## Application Description This project is a simple web-based calculator that performs basic mathematical operations. It allows users to calculate expressions and save the results. A "Show History" button displays previously saved calculations. Built with: - Frontend: HTML/CSS/JavaScript served via Nginx - Backend: Flask (Python) application connected to a PostgreSQL database - Database: PostgreSQL 15 --- ## Public Cloud Environment - Provider: Microsoft Azure - Service Used: Azure Kubernetes Service (AKS) - Certificate Issuer: cert-manager with Let's Encrypt - Domain: https://aliscloudwork.tech --- ## Kubernetes and Cloud Components - Deployments: - Frontend Deployment (Nginx server) - Backend Deployment (Flask server) - PostgreSQL Deployment (Database server) - Services: - Frontend Service (ClusterIP) - Backend Service (ClusterIP) - PostgreSQL Service (ClusterIP) - Ingress Controller Service (LoadBalancer) - Ingress: - Ingress resource used to route traffic and enable HTTPS - Persistent Volume: - PostgreSQL database uses a Persistent Volume Claim (PVC) for data persistence - Certificate Management: - cert-manager with Let's Encrypt to generate HTTPS certificates automatically --- ## Azure CLI Setup Steps ### 1. Create a Resource Group ```bash az group create --name aks-calculator-rg --location westeurope``` --- 2. Create AKS Cluster (basic version, no AGIC yet) az aks create \ --resource-group aks-calculator-rg \ --name calculatorAKS \ --node-count 1 \ --enable-managed-identity \ --generate-ssh-keys --- 3. Connect kubectl to Your AKS Cluster az aks get-credentials --resource-group aks-calculator-rg --name calculatorAKS kubectl get nodes --- Example output: shane@Ali-DESKTOP:~/assinments/cal$ kubectl get nodes NAME STATUS ROLES AGE VERSION aks-nodepool1-21170036-vmss000000 Ready 5m42s v1.31.7 --- Files Included prepare-app.sh: Script to deploy all Kubernetes objects and services automatically remove-app.sh: Script to delete all Kubernetes objects and services kubi/*.yaml: Kubernetes deployment, service, ingress, PVC configuration files backend/Dockerfile: Dockerfile for the Flask backend application frontend/Dockerfile: Dockerfile for the Nginx frontend application frontend/default.conf: Nginx configuration file for routing README.md: This documentation file --- How to View and Use the Application Open a web browser and visit: https://aliscloudwork.tech Use the calculator to perform operations. Click the "Show History" button to view saved calculations. --- Running Scripts To deploy the application: - bash prepare-app.sh To delete the application: - bash remove-app.sh --- xternal Sources and Tools Used DockerHub for container images Let's Encrypt for SSL certificates cert-manager for Kubernetes certificate automation Azure CLI for AKS management Official documentation for Nginx, Flask, Kubernetes YAML syntax --- Final Notes HTTPS is fully functional. Kubernetes ensures all components are modular and recover automatically. Database uses persistent storage for calculation history.