In the following test you will find four main subjects:
- Public Cloud: GCP
- Kubernetes: GKE
- CI/CD: Jenkins
- Observability and monitoring: Prometheus
NOTES
- Source code and files must be in a Git repository (choose what you prefer)
- Deploy the simple python app on GKE
- Make sure the python app:
- is resilient (hint: it must be restarted if a healthcheck fails)
- is reachable: you may use GKE Ingress. Hint: it takes a few minutes for the creation
- Add a new route for the python app
- Deploy a traffic generator which will call python app to the new route, created at the previous point
- Create CI + CD pipeline(s) for build the Docker images and rollout python and golang apps
- Install Prometheus into GKE (you can use Helm charts provide by community)
- Scrape metrics from python app
- Create a
PromQL
query to get theNUM_REQUESTS
- Install gcloud command
- SDK initialization
- Please choose
europe-west3-b
as default zone andeurope-west3
as default region
- Please choose
- Install
kubectl
- Configure project:
gcloud config set project <YOUR_GCP_PROJECT>
PROJECT_ID=$(gcloud config get-value project)
gcloud services enable container.googleapis.com
gcloud container clusters create SUB --machine-type=n1-standard-2 --num-nodes=3 --zone=europe-west3-b --project=$PROJECT_ID
gcloud container clusters get-credentials SUB --zone=europe-west3-b --project=$PROJECT_ID
- Create Compute Engine instance
gcloud beta compute --project=$PROJECT_ID instances create jenkins --zone=europe-west3-b --machine-type=e2-medium --subnet=default --network-tier=PREMIUM --maintenance-policy=MIGRATE --tags=jenkins-instance --image=debian-10-buster-v20210316 --image-project=debian-cloud --boot-disk-size=20GB --boot-disk-type=pd-balanced --boot-disk-device-name=jenkins-boot --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any
- Grant access to Jenkins UI
gcloud compute firewall-rules --project=$PROJECT_ID create fw-jenkins-http --source-ranges=<YOUR_IP_ADDRESS> --allow=tcp:443,tcp:8080 --direction=IN --network=default --target-tags=jenkins-instance
- SSH access to Compute Engine instance
gcloud beta compute ssh --zone "europe-west3-b" "jenkins" --project=$PROJECT_ID
gcloud container clusters delete SUB --zone=europe-west3-b --project=$PROJECT_ID
gcloud beta compute instances delete jenkins --zone=europe-west3-b --project=$PROJECT_ID
gcloud compute firewall-rules delete fw-jenkins-http --project=$PROJECT_ID