@@ -19,6 +19,24 @@ In order to deploy this app on Kubernetes we will need to complete the following
* Define a URL in order to access to your application
* Define a URL in order to access to your application
* Setup Gitlab CI in order to define the Continuous Delivery (CD)
* Setup Gitlab CI in order to define the Continuous Delivery (CD)
## Pre-requisits
### On your computer
* Git ust be installed
* Nice to have : a code editor (Atom, Visual Studio code ....)
* Connected to Pasteur VPN (or you won't be able to use all the tools)
### Gitlab
If you have never used Gitlab before, you will need to add an `ssh key` in your profile or define `HTTP` password in order to fetch the git repository.
@@ -349,6 +410,7 @@ Create a file `job.yaml` at the root directory of your git repository and fill i
We will use a `Job` in order to manage django migrations.
We will use a `Job` in order to manage django migrations.
> Note: Kubernetes jobs are run only once opposed to `Deployments` that run continiously. We put it in a seperate file because a Job is immutable and cannot be updated.
> Note: Kubernetes jobs are run only once opposed to `Deployments` that run continiously. We put it in a seperate file because a Job is immutable and cannot be updated.
If everything goes well, you should see that you have a pipeline with two steps:
- build
- deploy
You can see the log output by clicking on each one
### Informations available in Gitlab
Gitlab offer a basic set of features in order to manage your Kubernetes web application.
In the `Operations` section on the left panel you are able to view :
* Metrics : It will display basic memory and cpu graphs
* Environements : It will list all the environements you have created (you can have several deploy stages in your `.gitlab-ci.yml` : dev, stagging, production....) and give direcrt access to :
* Website link
* Monitoring
* Open a remote shell on the container
* Error Tracking : If your application implement error tracking on [sentry]: https://sentry.io/ errors are displayed here.
* Serverless : Feature not available here at Pasteur
## What else ?
## What else ?
### Is my deployed application is working ?
Now we want to know if what we have done is working; to do that just go in `Operations/Environements` and click on the first icon on the right hand side, it should open your web app.
You may have a `404 page not found` error, that's can be unfortunately normal for the first deployement, all you have to do is to restart the deploy job in the CI section of your gitlab project.
### Kubernetes dashboard
### Kubernetes dashboard
#### View your running workload
> We provide a web interface to visualise your workloads you have access to, you can connect to https://console.k8s-dev.pasteur.fr and follow the login process. On the left panel, you will find a drop down list and select your namespace. You will be able to view your Deployements, Pods, Services and so on.
#### Increase the number of replicas
#### Increase the number of replicas
If you want to increase the number of replicas of your web application, you can go in the Deployement section and select the 3 dots on the `polls` line; select `Scale`. You can increase or decrease the number of replicas. Kubernetes will automaticaly add or remove Pods.
> You can also update the file `polls.yaml` to change the replicas value (by default 1)
> Kubernetes will automatically load balance the traffic to the n PODS.
#### What happen if I kill a Pod ?
#### What happen if I kill a Pod ?
You can try to `Delete` the polls `Pod` using the 3 dots icon and see that Kubernetes will automaticaly restart a new one.
### Grafana : Metrics and Logs
### Grafana : Metrics and Logs
You can log on https://grafana.k8s-dev.pasteur.fr/ and browse the various dashboard available.
### Best Practices
### Best Practices
Always use Gitlab !!!
No newline at end of file
You git repository must be the source of truth, never change something directly on Kubernetes that needs to be persistent.
Integrate Kubernetes at the beginning of your project, you'll waste less time.