## Orchestrator ![Orchestrator](pictures/Orchestrator.jpg) ### Objectives In this project, you will deploy a microservices architecture on Kubernetes, You will gain experience with key technologies and concepts such as Kubernetes deployments, services, ingresses, and API gateways. Additionally, this project will provide you with an opportunity to practice DevOps skills such as containerization, continuous integration, and deployment (CI/CD), and infrastructure as code (IaC) using Kubernetes manifests. By completing this project, you will have a solid understanding of microservices architecture and the tools and techniques used to deploy and manage such systems using Kubernetes. ### Tips - Spend time on the theory before rushing into the practice. - Read the official documentation. > Any lack of understanding of the concepts of this project may affect the difficulty of future projects, Take your time to understand all concepts. > Be curious and never stop searching! ### Architecture ![Architecture](pictures/Architecture.png) You have to deploy this microservices architecture in a k3s cluster consisting of the following components: - `inventory-database container` is a PostgreSQL database server that contains your inventory database, it must be accessible via port `5432`. - `billing-database container` is a PostgreSQL database server that contains your billing database, it must be accessible via port `5432`. - `inventory-app container` is a Node.Js server that contains your inventory-app code running and connected to the inventory database and accessible via port `8080`. - `billing-app container` is a Node.Js server that contains your billing-app code running and connected to the billing database and consuming the messages from the RabbitMQ queue, and it can be accessed via port `8080`. - `RabbitMQ container` is a RabbitMQ server that contains the queue. - `api-gateway-app container` is a Node.Js server that contains your api-gateway-app code running and forwarding the requests to the other services and it's accessible via port `3000`. > You can use the Dockerfiles you created in the play-with-containers project! ### The cluster By using k3s in Vagrant you must create 2 virtual machines: 1. Master: the master in the k3s cluster. 2. Agent: an agent in the k3s cluster. You must install `kubectl` on your machine to manage your cluster. The nodes must be connected and available! ```console $> kubectl get nodes -A NAME STATUS ROLES AGE VERSION Ready XdXh vX Ready XdXh vX $> ``` You must provide a `orchestrator.sh` script that run and create and manage the infrastructure ```console $> ./orchestrator create cluster created $> ./orchestrator start cluster started $> ./orchestrator stop cluster stoped $> ``` ### Dockerhub You will need to push the Docker images for each component to Docker Hub. > You will use it in your kubernetes manifests. ![Dockerhub-example](pictures/dockerhub-example.jpg) ### Manifests You should create a YAML Manifest that describes each component or resource of your deployment. ### Secrets You must store your passwords and credentials as a k8s secrets > It's forbidden to put your passwords and credentials, in the YAML manifests, except the secret manifests! ### Node.JS apps Your Node.JS applications must be deployed as a deployment and they must be scaled horizontally automatically, depending on CPU consumption. - `api-gateway`: max replication: 3 min replication: 1 cpu percent triger: 60% - `billing-app`: max replication: 3 min replication: 1 cpu percent triger: 60% - `inventory-app`: max replication: 3 min replication: 1 cpu percent triger: 60% ### Databases Your databases must be deployed as Statefulset in your k3s cluster, and you must create volumes that enable containers to move across infrastructure without losing the data. ### Documentation You must push a `README.md` file containing full documentation of your solution (Prerequisites, Configuration, Setup, Usage, ...). ### Bonus If you complete the mandatory part successfully and you still have free time, you can implement anything that you feel deserves to be a bonus, Examples: - Deploy a Kubernetes Dashboard to monitor the cluster - Deploy a dashboard for applications logs Challenge yourself! ### Submission and audit You must submit the `README.md` file and all files used to create and delete and manage your infrastructure: Vagrantfile, Dockerfiles, Manifests,... ```console . ├── Manifests │ └── [...] ├── Scripts │ └── [...] ├── Dockerfiles │ └── [...] └── Vagrantfile ``` If you decide to use a different structure for your project remember you should be able to explain and justify your decision during the audit. > In the audit you will be asked different questions about the concepts and the practice of this project, prepare yourself!