devops-assignment

📖 About

This solution has two components:

  • Database: a PostgreSQL database, which is created using a Kubernetes Statefulset. See more here
  • Application: a simple Flask (Python) web app, which is deployed using Kubernetes Deployments. See more here

🤖 Setup

During the development of the solution, I used Minikube. It allows us to quickly set up a local Kubernetes cluster for testing purposes.

To create a new cluster:

minikube start

To discard an existing cluster:

minikube delete

I used minikube addons feature in order to provision metrics-server, which will be necessary for Kubernetes' HPAs to work properly. With the cluster already online, run:

minikube addons enable metrics-server

It's also worth to mention that minikube ships its own Dynamic Provisioner, k8s.io/minikube-hostpath, which uses hostPath. I used it to create the StorageClass for the PersistentVolumes used in the solution.

Finally, in order to interact with the cluster, kubectl is necessary. Its binary can be installed separately, or it can be used via minikube:

minikube kubectl

🤠 Usage

To deploy the database, run:

kubectl create -f database/

To deploy the app, run:

kubectl create -f app/

In order to access the aplication, the IP for the nodePort service can be found by running:

minikube service list --url simple-app