A simple Python web application with login functionality, containerized and deployed on Kubernetes. The application serves a login page and handles authentication with hardcoded credentials for demonstration purposes.
├── server.py # Python HTTP server implementation
├── index.html # Login page HTML file
├── deployment.yaml # Kubernetes deployment configuration
├── service.yaml # Kubernetes service configuration
└── README.md # Project documentation
-
Built with Python’s
http.servermodule -
Handles GET requests for serving the login page
-
Processes POST requests for login authentication
-
Hardcoded credentials:
- Username:
admin - Password:
1234
- Username:
-
Server runs on port 8001
- Clean, responsive login form
- CSS styling for modern appearance
- Form submission to
/loginendpoint
- Deployment name:
pythonapp-deployment - Replicas: 2 (for high availability)
- Container image:
ima110/pythonapp:latest - Container port: 8001
- Service name:
python-app-service - Type:
LoadBalancer - External port: 80
- Target port: 8001
- Selector:
app: pythonapp
- A running Kubernetes cluster
- kubectl configured
- Docker image available at ima110/pythonapp:latest
# Apply the deployment
kubectl apply -f deployment.yaml
# Apply the service
kubectl apply -f service.yaml# Check deployment status
kubectl get deployments
# Check service and get external IP
kubectl get services
# Monitor pods
kubectl get pods -l app=pythonappOnce deployed, access the app using the external IP from the LoadBalancer service:
http://<EXTERNAL-IP>/Username: admin
Password: 1234
# View application logs
kubectl logs -l app=pythonapp
# Check pod status
kubectl get pods -l app=pythonapp
# View detailed pod information
kubectl describe pod -l app=pythonappThis application uses hardcoded credentials for demonstration only. For production environments:
- Implement secure credential storage
- Use environment variables
- Enforce HTTPS and encryption
The deployment is compatible with Jenkins CI/CD pipelines.
Jenkins dynamically updates the deployment by replacing the latest image tag with the appropriate build tag during automated deployment.