Browse Source

feat(orchestrator): make subject and audit lang angnostic

pull/2333/head^2
nprimo 6 months ago committed by MSilva95
parent
commit
c4a8eb51d3
  1. 136
      subjects/devops/orchestrator/README.md
  2. 62
      subjects/devops/orchestrator/audit/README.md

136
subjects/devops/orchestrator/README.md

@ -4,7 +4,15 @@
### Objectives
In this project, You will deploy a microservices architecture on Kubernetes, you will gain experience with key technologies and concepts such as Kubernetes architecture, 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.
In this project, You will deploy a microservices' architecture on Kubernetes,
you will gain experience with key technologies and concepts such as Kubernetes
architecture, 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
@ -12,7 +20,8 @@ In this project, You will deploy a microservices architecture on Kubernetes, you
- Read the official documentation.
- You must understand the K8s components.
> Any lack of understanding of the concepts of this project may affect the difficulty of future projects, take your time to understand all concepts.
> 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!
@ -20,16 +29,26 @@ In this project, You will deploy a microservices architecture on Kubernetes, you
![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`.
You have to deploy these 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 server that contains your
inventory-app code running and connected to the inventory database and
accessible via port `8080`.
- `billing-app container` is a 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`.
- `api-gateway-app container` is a server that contains your
API gateway 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!
> You can use the Dockerfiles you created in the `play-with-containers`
> project!
### The cluster
@ -43,73 +62,72 @@ 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
```console
$> kubectl get nodes -A NAME
STATUS ROLES AGE VERSION
<master-node> Ready <none> XdXh vX
<agent1-node> Ready <none> XdXh vX
<agent1-node> Ready <none> XdXh vX
$>
```
You must provide a `orchestrator.sh` script that run and create and manage the infrastructure:
You must provide a `orchestrator.sh` script that run and create and manage the
infrastructure:
```console
$> ./orchestrator create
```console
$> ./orchestrator.sh create
cluster created
$> ./orchestrator start
cluster started
$> ./orchestrator stop
cluster stopped
$>
$> ./orchestrator.sh start
cluster started
$> ./orchestrator.sh stop cluster stopped $>
```
### Docker Hub
You will need to push the Docker images for each component to Docker Hub.
> You will use it in your kubernetes manifests.
> You will use it in your Kubernetes manifests.
![Dockerhub-example](pictures/dockerhub-example.jpg)
![Docker Hub example](pictures/dockerhub-example.jpg)
### Manifests
You should create a YAML Manifest that describes each component or resource of your deployment.
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!
> It's forbidden to put your passwords and credentials in the YAML manifests,
> except the secret manifests!
### Node.js apps
### Applications deployment instructions
This Node.js applications must be deployed as a deployment and they must be scaled horizontally automatically, depending on CPU consumption.
The following 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 trigger: 60%
- `api-gateway`: max replication: 3 min replication: 1 CPU percent trigger: 60%
- `inventory-app`:
max replication: 3
min replication: 1
cpu percent trigger: 60%
- `inventory-app`: max replication: 3 min replication: 1 CPU percent trigger:
60%
This Node.js application must be deployed as StatefulSet:
- `billing-app`
The `billing-app` must be deployed as *StatefulSet*.
### 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.
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, ...).
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, for example:
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, for example:
- Deploy a Kubernetes Dashboard to monitor the cluster
@ -121,24 +139,30 @@ 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
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.
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!
> In the audit you will be asked different questions about the concepts and the
> practice of this project, prepare yourself!
#### What's next?
In order to develop your knowledge and career as a devops engineer, we highly recommend you to learn and practice more about kubernetes and even get a certification for kubernetes.
In order to develop your knowledge and career as a DevOps engineer, we highly
recommend you to learn and practice more about Kubernetes and even get a
certification for Kubernetes.
[https://kubernetes.io/training/](https://kubernetes.io/training/)

62
subjects/devops/orchestrator/audit/README.md

@ -2,7 +2,14 @@
##### Check the Repo content
A `README.md` and `orchestrator.sh` and `Vagrantfile` files and all files used to create and delete and manage the student infrastructure must be submitted in the repo.
The repo contains a `README.md`, an `orchestrator.sh` script, a `Vagrantfile`
and all the additional files used to create, delete and manage the submitted
infrastructure.
###### Are all the required files present?
###### Does the project as a structure similar to the one below? If not, can the student provide a justification for the chosen project structure?
```console
.
@ -15,21 +22,20 @@ A `README.md` and `orchestrator.sh` and `Vagrantfile` files and all files used t
└── Vagrantfile
```
###### Are all the required files present?
##### Ask the following questions to the group or student
- What is container orchestration and what are its benefits?
- What is container orchestration, and what are its benefits?
- What is Kubernetes and what is its main role?
- What is Kubernetes, and what is its main role?
- What are K3s and what is their main role?
- What is K3s, and what is their main role?
###### Did the student reply correctly to the questions?
##### Check the Student Documentation
The Documentation must exist in the `README.md` file!
> There must be a `README.md` file with the project Documentation
###### Did the README.md file contains all the required information about the solution (prerequisites, configuration, setup, usage, ...)?
@ -41,9 +47,9 @@ The Documentation must exist in the `README.md` file!
By using K3s in Vagrant two virtual machines must be created:
1. Master: the master in the K3s cluster.
1. `Master`: the master in the K3s cluster.
2. Agent: an agent in the K3s cluster.
2. `Agent`: an agent in the K3s cluster.
`kubectl` must be installed and configured in the learner machine to manage the cluster.
@ -51,17 +57,17 @@ The nodes must be connected and available, try:
```console
$> kubectl get nodes -A
NAME STATUS ROLES AGE VERSION
NAME STATUS ROLES AGE VERSION
<master-node> Ready <none> XdXh vX
<agent1-node> Ready <none> XdXh vX
$>
```
###### Is kubectl installed and configured in the learner's machine?
###### Was the cluster created by a Vagrantfile?
###### Does the cluster contains two nodes (master and agent)?
###### Is kubectl installed and configured in the learner's machine?
###### Does the cluster contain two nodes (*master* and *agent*)?
###### Are the nodes connected and ready for usage?
@ -94,9 +100,9 @@ user:~$
- What is infrastructure as code and what are the advantages of it?
- Explain What is a K8s manifest.
- Explain what is a K8s manifest.
- Explain the K8s manifests.
- Explain each K8s manifests.
###### Did the student reply correctly to the questions?
@ -120,44 +126,42 @@ user:~$
- `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`.
- `inventory-app container` is a server that contains your inventory-app code running and connected to the inventory database and accessible via port `8080`.
- `billing-app container` is a 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`.
- `api-gateway-app container` is a server that contains your api-gateway-app code running and forwarding the requests to the other services and it's accessible via port `3000`.
###### Are all the required applications deployed?
- databases must be deployed as StatefulSet, and volumes that enable containers to move across infrastructure without losing the data must be created.
- Databases must be deployed as *StatefulSet*, and volumes that enable containers to move across infrastructure without losing the data must be created.
- Node.js applications must be deployed as a deployment and they must be scaled horizontally automatically, depending on CPU consumption:
- The following applications must be deployed as a deployment, and they must be scaled horizontally automatically, depending on CPU consumption:
1. `api-gateway`:
max replication: 3
min replication: 1
cpu percent trigger: 60%
CPU percent trigger: 60%
2. `inventory-app`:
max replication: 3
min replication: 1
cpu percent trigger: 60%
This Node.js application must be deployed as StatefulSet:
CPU percent trigger: 60%
1. `billing-app`
The `billing-app` must be deployed as *StatefulSet*.
###### Do all apps deploy with the correct configuration?
##### Ask the following questions to the group or student
- What is StatefulSet in K8s?
- What is *StatefulSet* in K8s?
- What is deployment in K8s?
- What is *deployment* in K8s?
- What is the difference between deployment and StatefulSet in K8s?
- What is the difference between *deployment* and *StatefulSet* in K8s?
- What is scaling and why do we use it?
- What is scaling, and why do we use it?
- What is a load balancer and what is its role?
- What is a load balancer, and what is its role?
- Why we don't put the database as a deployment?

Loading…
Cancel
Save