Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azhar22k/docker-flask
Dockerised flask app configured to run on k8s as well
https://github.com/azhar22k/docker-flask
docker docker-compose flask k8s kompose python virtualenv
Last synced: 9 days ago
JSON representation
Dockerised flask app configured to run on k8s as well
- Host: GitHub
- URL: https://github.com/azhar22k/docker-flask
- Owner: azhar22k
- Created: 2020-03-31T09:51:44.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-01T21:23:57.000Z (over 1 year ago)
- Last Synced: 2024-11-03T10:16:59.691Z (about 2 months ago)
- Topics: docker, docker-compose, flask, k8s, kompose, python, virtualenv
- Language: Python
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-flask
Dockerised flask app configured to run on k8s as well# Workflow
```
First clone this repo locally
```The app can be run in 3 ways
* [Python virtualenv](#virtualenv)
* [Docker](#docker)
* [Kubernetes(k8s)](#kubernetes)## Virtualenv
1. Create and setup virtual environment
```shell
python3 -m venv venv;
source venv/bin/activate;
python3 -r requirements.text;
```2. Start App
```shell
python3 app.py;
```3. Stop and deactivate virtualenv
```bash
Ctrl+c
deactivate;
```## Docker
1. Setup `.env` file (To see the values required check [.env.sample](.env.sample))
2. Start Service```shell
docker-compose --compatibility up;
```3. Stop Service
```shell
Ctrl+c
```## Kubernetes
1. Install kompose
```shell
brew install kompose;
```2. Convert `docker-compose.yml` to `kubectl` compatible files
```shell
kompose convert;
```3. Create a namespace for your resource
```shell
kubectl create namespace demo;
```4. Deploy your code to kubernetes
```shell
kubectl apply \
-f env-configmap.yaml \
-f docker-flask-deployment.yaml \
-f docker-flask-service.yaml \
-n demo;
```5. Get Inro About the App
```shell
kubectl get deployment,service,pods -n demo;
```6. Remove Everything
```shell
kubectl delete namespace demo;
```