From 97e54d0f2cdc13779397a7c9b35ba16defa3ad84 Mon Sep 17 00:00:00 2001 From: Claude Dioudonnat Date: Wed, 15 May 2024 14:31:31 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7(jenny)=20use=20proper=20check=20fo?= =?UTF-8?q?r=20kube=20probes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the Django app we use the hearbeat add by the lib dockerflow for the liveness and readiness probes Use Nginx status page for liveness probe. And check migration for the startup probe. --- jenny/templates/configmap.yaml | 13 +++++++++++++ jenny/templates/deployment.yaml | 20 ++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/jenny/templates/configmap.yaml b/jenny/templates/configmap.yaml index 68cf028..4e86a32 100644 --- a/jenny/templates/configmap.yaml +++ b/jenny/templates/configmap.yaml @@ -39,6 +39,19 @@ data: } } + server { + listen 5000; + server_name localhost; + + location /__status__ { + stub_status; + allow 127.0.0.1; + deny all; + access_log off; + } + + } + types { text/html html htm shtml; text/css css; diff --git a/jenny/templates/deployment.yaml b/jenny/templates/deployment.yaml index d2140b6..37b09be 100644 --- a/jenny/templates/deployment.yaml +++ b/jenny/templates/deployment.yaml @@ -43,7 +43,7 @@ spec: {{- toYaml .Values.resources | nindent 12 }} livenessProbe: httpGet: - path: / + path: /__heartbeat__ port: {{ .Values.django.port }} httpHeaders: - name: "Host" @@ -52,13 +52,23 @@ spec: periodSeconds: 30 readinessProbe: httpGet: - path: / + path: /__lbheartbeat__ port: {{ .Values.django.port }} httpHeaders: - name: "Host" value: "{{ .Values.ingress.host}}" initialDelaySeconds: 5 periodSeconds: 5 + startupProbe: + exec: + command: + - python3 + - manage.py + - migrate + - --check + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 30 env: {{- include "jenny.envs" . | nindent 12 }} - name: "UWSGI_PORT" @@ -79,6 +89,12 @@ spec: - name: nginx mountPath: /etc/nginx readOnly: true + livenessProbe: + httpGet: + path: /__status__ + port: 5000 + initialDelaySeconds: 15 + periodSeconds: 30 volumes: - name: {{ .Values.volumes.media.name }} persistentVolumeClaim: