From c3f04b3a7c930cb715f62605a0476d76f69f262c Mon Sep 17 00:00:00 2001 From: Thomas MENARD <thomas.menard@pasteur.fr> Date: Thu, 6 Jun 2019 14:41:51 +0200 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20du=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ff6d78c..7306fd0 100644 --- a/README.md +++ b/README.md @@ -106,12 +106,15 @@ Save, commit and push; you should be abble to see your first running pipeline Once succesfully completed, you can see the docker image in the `Registry`section on the left pane. -### Create manifest yaml file +### Create manifests yaml files -Create a file `manifest.yaml` at the root directory of your git repository and fill it with the following definition. +We are going to create manifest files at the root directory of your git repository and fill it with the following definition. > Keep in mind that yaml formating require that you seperate each declaration with `---` line. #### PostgreSQL Server + +> Create `postgresql.yaml` file + In order to deploy a Postgresql server we need : - [ ] Storage @@ -240,9 +243,12 @@ spec: selector: app: postgresql tier: postgreSQL -```` +``` #### Django Application + +> Create `polls.yaml` file + ##### Deployment ```yaml @@ -405,9 +411,12 @@ deploy: script: - kubectl delete secret registry-gitlab -n ${NAMESPACE} --ignore-not-found=true - kubectl create secret docker-registry -n ${NAMESPACE} registry-gitlab --docker-server=registry-gitlab.pasteur.fr --docker-username=${DEPLOY_USER} --docker-password=${DEPLOY_TOKEN} --docker-email=kubernetes@pasteur.fr - - envsubst < manifest.yaml | kubectl apply -n ${NAMESPACE} -f - + - envsubst < postgresql.yaml | kubectl apply -n ${NAMESPACE} -f - + - kubectl wait --for=condition=available --timeout=600s deployment/postgresql - kubectl delete job polls-migrations -n ${NAMESPACE} --ignore-not-found=true - envsubst < job.yaml | kubectl apply -n ${NAMESPACE} -f - + - kubectl wait --for=condition=complete --timeout=600s job/polls-migrations + - envsubst < polls.yaml | kubectl apply -n ${NAMESPACE} -f - - kubectl patch deployment polls -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}" ``` @@ -436,17 +445,28 @@ In the `Operations` section on the left panel you are able to view : 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 unfortunately normal for the first deployement. +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 -#### 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 +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. + #### 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 +You can log on https://grafana.k8s-dev.pasteur.fr/ and browse the various dashboard available. + ### 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. + -- GitLab