This directory contains Kubernetes manifests organized by application groups for better learning and understanding.
Complete MySQL database application with all related resources:
mysql-configmap.yml- Environment variables for MySQL (MYSQL_ROOT_PASSWORD)mysql-database-deployment.yml- Main MySQL deployment with persistent storagemysql-database-storage.yml- PersistentVolumeClaim for MySQL datamysql-alternative-configmap.yml- Alternative ConfigMap with different key namemysql-alternative-deployment.yml- Alternative deployment using specific ConfigMap key reference
Complete nginx web server application with various deployment patterns:
Core Resources:
nginx-web-html-configmap.yml- HTML content for nginx index pagenginx-web-deployment.yml- Full-featured nginx deployment with health checks, volumes, and ConfigMapnginx-web-service.yml- NodePort service to expose nginx externallynginx-web-persistent-storage.yml- PersistentVolumeClaim for nginx contentnginx-web-ingress.yml- Ingress resource for HTTP/HTTPS routing with hostname and path rulesnginx-web-ingress-alternative.yml- Alternative Ingress configuration (renamed from parham-ingress.yml)nginx-web-service-clusterip.yml- ClusterIP service for Ingress backendnginx-web-service-for-ingress.yml- Additional ClusterIP service for Ingress
Node Scheduling Examples:
nginx-node-selector-deployment.yml- nginx deployment with nodeSelectornginx-node-affinity-deployment.yml- nginx deployment with nodeAffinity (required)nginx-nodename-deployment.yml- nginx deployment with nodeName (direct node assignment)nginx-specific-node-deployment.yml- nginx deployment with specific node assignment
Session 8 - Advanced Patterns:
session-8/nginx-web-deployment.yml- Basic nginx deployment with 3 replicassession-8/nginx-web-service.yml- ClusterIP service for session 8 deploymentsession-8/nginx-web-production-ingress.yml- Production ingress with TLS and path rewritingsession-8/statefulset/nginx-web-stateful-set.yml- StatefulSet with ordered deploymentsession-8/statefulset/nginx-web-headless-service.yml- Headless service for StatefulSet
Session 9 - Resource Management:
session-9/nginx-web-deployment-resource.yml- Deployment with CPU and memory resource limitssession-9/nginx-web-deployment-resource-service.yml- Service for resource-managed deployment
Individual Pod examples and their services:
basic-nginx-pod.yml- Simple nginx Pod with labelstest-nginx-pod.yml- Test nginx Podstandalone-nginx-service.yml- Service for standalone nginx pods
Python application example that writes to MySQL database:
Application Files:
app.py- Python application that writes timestamps to MySQL database every 60 secondsdockerfile- Dockerfile for building the Python app containerREADME.txt- Instructions for setting up MySQL and running the appexercise.txt- Step-by-step exercise guide
Kubernetes Manifests:
k8s/mysql-secret.yaml- Secret for MySQL root passwordk8s/mysql-statefulset.yaml- StatefulSet for MySQL databasek8s/mysql-service.yaml- Service for MySQL databasek8s/python-app-secret.yaml- Secret for Python app database credentialsk8s/python-app-deployment.yaml- Deployment for Python applicationk8s/phpmyadmin-deployment.yaml- Deployment for phpMyAdmin web interfacek8s/phpmyadmin-service.yaml- NodePort service for phpMyAdmink8s/phpmyadmin-ingress.yaml- Ingress for phpMyAdmin access
- Environment variable injection (
envFrom) - Specific key references (
configMapKeyRef) - Configuration data storage
- Replica management
- Pod templates and selectors
- Health checks (liveness/readiness probes)
- Volume mounting
- Node scheduling (selectors, affinity)
- Pod selection via labels
- Port mapping
- Service types (NodePort)
- PersistentVolumeClaims
- Volume mounting in containers
- Data persistence
- nodeSelector: Hard requirement for specific node labels
- nodeAffinity: Advanced scheduling rules (required/preferred)
- nodeName: Direct node assignment (bypasses scheduler)
- HTTP/HTTPS routing with hostname rules
- Path-based routing with different path types
- Service backend configuration
- Ingress controller integration
- Ordered deployment and scaling
- Stable network identity
- Persistent storage per pod
- Headless services for direct pod access
- CPU and memory requests and limits
- Preventing noisy neighbor issues
- Resource quotas and constraints
- Quality of Service (QoS) classes
- Storing sensitive data (passwords, credentials)
- Environment variable injection from Secrets
- Secret references in pods and deployments
- Best practices for secret management
- Database tier (MySQL StatefulSet)
- Application tier (Python app Deployment)
- Admin interface tier (phpMyAdmin)
- Service communication between tiers
- Secret sharing across components
-
Deploy a complete application:
kubectl apply -f manifests/mysql-database/ kubectl apply -f manifests/nginx-web-server/
-
Deploy individual resources:
kubectl apply -f manifests/standalone-pods/basic-nginx-pod.yml
-
Check resource status:
kubectl get pods,services,configmaps,pvc
All resources now use descriptive, consistent naming:
- ConfigMaps:
{application}-{purpose}-configmap(e.g.,nginx-web-html-configmap) - Deployments:
{application}-{type}-deployment(e.g.,nginx-web-simple-deployment,nginx-web-node-affinity-deployment) - Services:
{application}-service-{type}(e.g.,nginx-web-service-nodeport,nginx-web-service-clusterip) - Storage:
{application}-{type}-storage(e.g.,nginx-web-persistent-storage) - Ingress:
{application}-ingressor{application}-ingress-{variant}(e.g.,nginx-web-ingress-alternative) - Containers:
{application}-container(e.g.,nginx-web-container) - App Labels:
{application}-{purpose}(e.g.,nginx-web-simple,nginx-web-node-affinity)
Each application folder contains all related resources that work together:
- ConfigMaps are referenced by their corresponding Deployments
- Services select Pods using matching labels
- Deployments reference PVCs for persistent storage
- All names are consistent across related resources
Python Multi-Tier Application (Latest Update):
- Added Python app example demonstrating a real-world multi-tier application
- MySQL StatefulSet for persistent database storage
- Python application that writes timestamps to MySQL every 60 seconds
- phpMyAdmin interface for database management and visualization
- Secrets management for database credentials and connection strings
- Resource limits applied to Python application
- Complete exercise guide with step-by-step instructions
Session 9 - Resource Management:
- Added Session 9 folder with resource management patterns
- CPU and memory limits to prevent noisy neighbor issues
- Resource requests and limits for guaranteed and maximum resource allocation
- Quality of Service (QoS) classes for pod prioritization
- Comprehensive comments explaining resource management concepts
Session 8 - Advanced Kubernetes Patterns:
- Added Session 8 folder with advanced deployment patterns
- StatefulSet implementation with ordered deployment and stable network identity
- Headless services for direct pod access in StatefulSets
- Production ingress with TLS configuration and path rewriting
- Comprehensive comments added to all files for educational purposes
- Improved naming conventions with simplified, consistent resource names
- Fixed resource relationships ensuring all cross-references are correct
Previous Improvements:
- Removed personal names (e.g.,
parham-ingress.yml→nginx-web-ingress-alternative.yml) - Standardized all container names to
nginx-web-container - Enhanced deployment names with descriptive suffixes
- Updated all cross-references between resources to maintain consistency