This Project demonstrates how to deploy an API in docker and Kubernetes,
The api has been built using Flask and supported by a mysql database
For all the steps
- git clone https://github.com/DiptoChakrabarty/api.git
- cd apiapp
- Initialize DataBase
In your terminal
> python3
> from apiapp import db
> db.create_all()
> exit
- Run Application API
python3 app.py
Dockerfile for flask backend is in current directory
Dockerfile for DataBase is in folder db
- To run in background
docker-compose up -d
- Run Normally
docker-compose up
I have run and tested the application in minikube and online kubernetes IDE
- kubectl apply -f kube
- Check service Ip of app
kubectl get svc
- Send requests in the ip provided in the service ip
You can send request using Postman or using your terminal
Route | Method | Function |
---|---|---|
/productadd | POST | Add data |
/products | GET | Show data |
/product/id | GET | Show individual items data |
/product/id | PUT | Update items data |
/product/id | DELETE | Delete items |
/users | POST | Register User |
/auth | POST | Login User |
- Flask
- Flask-SQLAlchemy
- SQL
- Docker
- Docker Compose
- Kubernetes