Url Shortener System Design Implementation - Part 2

So the next steps after generating tests and testing the application is as follows - Build Dockerfile for the app and run the app locally with redis and mongodb running locally or via docker After testing them locally, run them inside docker-compose to understand docker networking and DNS resolution Build docker images with proper tags to be used for kubernetes deployment and upload to Dockerhub Install minikube and run it locally Generate YAML files for MongoDB and Redis with deployment and services configuration and run them stateless Note their FQDN <service>.<namespace>.svc.cluster.local and add them as K8s env variables to be used Create YAML file for FastAPI application with environment set and with deployment, service and ingress and apply it Check the application running and access it via command minikube tunnel Deploying to local Kubernetes Make sure to install minikube as per their documentation - https://minikube.sigs.k8s.io/docs/start/?arch=%2Fwindows%2Fx86-64%2Fstable%2F.exe+download ...

December 3, 2024 · 9 min

Kubernetes Design Patterns

Multi-container design patterns Sidecar pattern An extra container in your pod to enhance or extend the functionality of the main container. Ambassador pattern A container that proxy the network connection to the main container. Adapter pattern A container that transform output of the main container. Reference - https://kubernetes.io/blog/2015/06/the-distributed-system-toolkit-patterns/ The idea for a sidecar container is to add some functionality not present in the main container. Rather than bloating code, which may not be necessary in other deployments, adding a container to handle a function such as logging solves the issue, while remaining decoupled and scalable. Prometheus monitoring and Fluentd logging leverage sidecar containers to collect data. ...

September 13, 2024 · 2 min

MongoDB StatefulSet Setup

Creating a MongoDB Replica Set with authentication using StatefulSets involves several steps. Below is a manifest example for deploying a MongoDB Replica Set with authentication using StatefulSets in Kubernetes. This assumes you have a Kubernetes cluster set up and kubectl configured. Create a Secret for MongoDB Authentication: Create a Kubernetes Secret to store the MongoDB admin credentials. You can encode the username and password using echo -n 'yourpassword' | base64: ...

July 11, 2024 · 2 min