This project is a simple Flask web application deployed in Kubernetes using Istio for traffic management and monitoring.
├── Makefile
├── README.md
├── kustomization.yaml
├── patches
│ ├── grafana-cm.yaml
│ └── kustomization.yaml
├── python-app
│ ├── Dockerfile
│ ├── app.py
│ ├── k8s
│ │ ├── base
│ │ │ ├── app-service.yaml
│ │ │ ├── ingressgateway-istio.yaml
│ │ │ ├── kustomization.yaml
│ │ │ ├── v1
│ │ │ │ └── app-deployment-v1.yaml
│ │ │ ├── v2
│ │ │ │ └── app-deployment-v2.yaml
│ │ │ └── v3
│ │ │ └── app-deployment-v3.yaml
│ │ ├── destination-rule.yaml
│ │ ├── kustomization.yaml
│ │ ├── security
│ │ │ ├── auth-policy.yaml
│ │ │ ├── kustomization.yaml
│ │ │ └── peer-authentication.yaml
│ │ └── vs.yaml
│ └── templates
│ └── index.html
└── tests
└── h2load.sh
app.py
- Main Flask application file.Dockerfile
- Docker image for the application.templates/index.html
- HTML template for the homepage.Makefile
- Automation scripts for tasks like starting Minikube, installing Istio, and deploying the app.k8s/
- Kubernetes manifests for deploying the application.tests/h2load.sh
- Script for performance testing.patches
- PatchConfigMap
to access grafana dashboard using istioVirtualService
.
- Python 3.11
- Docker
- Minikube
- Istio
- Kubernetes CLI (
kubectl
) - Istio CLI (
istioctl
)
make start-minikube
make install-istio
You can build the Docker image for the application using the provided Dockerfile. The Dockerfile is located in the python-app
directory.
docker build -t istio-python-app:latest python-app/
docker tag istio-python-app:latest <your-registry>/istio-python-app:latest
docker push <your-registry>/istio-python-app:latest
And then change the image name in the deployments files located in python-app/k8s/base/
(v1
, v2
, v3
folders) to match your registry.
make create-python-app
kubectl port-forward -n istio-system service/istio-ingressgateway 8080:80
After deployment, the application will be accessible via the Istio Ingress Gateway. To get access by URL add the following into the /etc/hosts
file:
127.0.0.1 example.local
Then, you can access the application using the following URL:
http://example.local:8080/app
To access the grafana dashboard you can use the following URL:
http://example.local:8080/grafana
To access the Kiali dashboard, you can use the following URL:
http://example.local:8080/kiali
You can also access to the API endpoint using the following command:
curl -H "Authorization: Bearer my-static-token-123" http://example.local:8080/app/api
To test the application, you can use the h2load.sh
script located in the tests
directory. This script uses h2load
to perform load testing on the application.
Use the following command to run the test:
make test-python-app
- Prometheus: Application metrics.
- Kiali: Visualization of network traffic.