How harishappana1/aks_python works
Project type and purpose
• This is a lightweight, containerized Python micro-service intended for local testing on Kubernetes (Minikube).
• Key indicators:
• app.py (the service code)
• Dockerfile (defines a container image)
• deployment.yaml & service.yaml (Kubernetes manifests)
• .github/workflows/build-and-push.yml (CI/CD pipeline)
File structure
• Top-level files:
• app.py – the application entry point
• test.py – a test harness for the service
• requirements.txt – Python dependencies
• Dockerfile – container build instructions
• deployment.yaml – Kubernetes Deployment spec
• service.yaml (typoed “serive.yaml”) – Kubernetes Service spec
• .github/workflows/build-and-push.yml – GitHub Actions workflow
• Patterns & infrastructure:
• Container + Kubernetes (minikube)
• CI/CD builds & pushes image
README for additional insights
• Workflow:
• Build Docker image locally
• Start Minikube, point Docker CLI at Minikube’s registry
• kubectl apply Deployment + Service
• Expose the app via a NodePort/LoadBalancer
• Uses Azure AD service principal for RBAC in other contexts
a. Main components
• Developer workstation (code + tests)
• GitHub repository + GitHub Actions runner
• Docker Registry (Minikube’s local registry or remote)
• Kubernetes cluster (Minikube VM)
• Kubernetes Master
• Worker node(s) running Pods
• Pod(s) running containerized app.py
• Kubernetes Service object exposing the Pods
• External client (e.g., browser or curl)
• (Optional) Azure AD as an external identity provider for RBAC
b. Relationships & interactions
1. Developer pushes code → GitHub
2. GitHub Actions: build image → push to registry
3. kubectl (or CI) deploys Deployment + Service → Kubernetes API server
4. Scheduler places Pod(s) on worker node(s); Pod downloads image from registry
5. Service routes external traffic to Pod(s) on specified port
6. Client → Service → Pod(s) → app.py handles request → returns response
c. Architectural patterns & design principles
• Twelve-factor app: dependencies declared (requirements.txt), config via environment
• Containerization: isolation and reproducible builds
• Immutable infrastructure: redeploy via Deployment spec
• Declarative infrastructure as code (Kubernetes manifests)
• CI/CD: automated build & deploy
d. Key technologies
• Python + Flask (or similar) in app.py
• Docker
• Kubernetes (Minikube)
• GitHub Actions
• Azure AD (RBAC)
Detailed breakdown
1. CI/CD pipeline (GitHub Actions): code → build → push
2. Container Registry: image storage
3. Kubernetes Control Plane: API server, scheduler
4. Worker Node(s): Pod(s) running app container
5. Kubernetes Service: load-balancer or NodePort
6. Client: end-user or test script
7. External identity: Azure AD SP (if RBAC is in scope)