Skip to content

mnhmilu/poc-kubernets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes-based microservice

Road Map with Milestone

Learning Trail


Example 8

Topic: FastAPI in Docker swarm with Postgres database + ORM

Key Takeaway: 

- How to configure Docker Swarm by creating a master and worker node 
- How to deploy a FastAPI backend with ORM and Postgres server to run in configured Docker Swarm
- How to replicate web app to 3 

Steps:


Make sure all worker node are ready if not update iptable to allow connect and leave and join again to master

Transfer App folder which contain source , docker file , docker-compose yml to master node using file zilla 

docker pull postgres:15-alpine // will pull posgres image 

docker-compose build // it will build app image for local

docker stack deploy -c docker-compose.yml nahid_apps  //deploy the stack in docker swarm

now call swagger http://192.168.0.121:8000/docs

table will auto created

user swagger to create a new sample user and get a list to see if it added a new user

for any error see the service logs 

docker service ls

docker service logs nahid_apps_db

Commit Ref:

Readme : Wiki for Docker Swarm in Home Network


Upcoming: Update example 7 with config map, secret and use middleware


Example 6 updated

Topic: FastAPI in minikube with Postgres database with configmap and secret

Key Takeaway: 

- How to apply configmap and secret in kubernets in deployment file as db user ,password , db host etc
- How to troubleshoot CrashLoopBackOff
  use `kubectl describe pod x ` and then `kubectl logs pods to identify problem
- How to use base64 encoded db username and password in a secret file and how to decode in main.py 

Commit Ref: dc1c52e9f6ad98d7e988e9ab3316f5d5fa47b201


Example 7

Topic: FastAPI with Postgres database using Docker compose and ORM

Key Takeaway: 

- Deploy Postgresql database
- Deploy fast API API set with CRUD operation 
- ORM used for Postgres connectivity
- SQLite in database.py for in-memory database
- Service declared in docker-compose file, where fast API connect with db

docker-compose up -d --build

docker-compose logs app

after run:

from browser http://localhost:8000/docs for swagger

Source


Example 6

Topic: FastAPI in minikube with Postgres database

Key Takeaway: 

- Deploy Postgresql database
- Deploy fast API API set with CRUD operation with load balancer
- Python client added for database entry
- Learned how to resolve 'ImpagePullBackoff' problem by running and push in local registry
- Docker Registry created, build an image with name and tag and push to local docker repository

Example 5

Topic: FastAPI in minikube

Key Takeaway: 
Minikube and docker env sync
Reason behind the imagepullbackoff in minikube's own docker env
How to run simple FastAPI in minikube environment
How to see events easily in minikube dashboard
How to check minikube's kubernet config file

Example 4

Topic: Mongo Express with Mongo DB

Key Takeaway: 
- How to deploy MongoDB image in Kubernetes with deployment and service without exposing the external world
- How to deploy MongoDB express with exposed service
- How to use Kubernetes Config
- How to use Kubernetes Secret 

Source

Roadmap

Resources
  1. Learning Plan Details
  2. Concepts
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

Resoureces

Learn Plan

Resources

Readme

Persistence Volume

Kubernetics Full Courses

How to write a good Readme

Built With

This section should list any major frameworks/libraries used to bootstrap your project. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.

  • React
  • React
  • React
  • React

Buy me a Coffee!