From 1d6bcde8b276aa61885a0c58b962804f4b1c3dc1 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes da Costa Date: Thu, 28 Nov 2024 10:07:27 -0300 Subject: [PATCH 1/2] upgrade chart to support multiple replicas --- chart/Chart.yaml | 4 ++-- chart/templates/ai-deployment.yaml | 2 +- chart/templates/api-deployment.yaml | 2 +- chart/templates/web-deployment.yaml | 2 +- chart/values.yaml | 12 ++++++++---- docs/deployment/kubernetes.mdx | 29 ++++++++++++++++++++++++----- 6 files changed, 37 insertions(+), 14 deletions(-) diff --git a/chart/Chart.yaml b/chart/Chart.yaml index eef5562..6582e9b 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: briefer description: The helm chart for Briefer's open-source version. type: application -version: 0.1.3 -appVersion: '0.1.3' +version: 0.1.4 +appVersion: '0.1.4' diff --git a/chart/templates/ai-deployment.yaml b/chart/templates/ai-deployment.yaml index c168c6c..24780bd 100644 --- a/chart/templates/ai-deployment.yaml +++ b/chart/templates/ai-deployment.yaml @@ -8,7 +8,7 @@ metadata: app.kubernetes.io/name: briefer app.kubernetes.io/component: ai spec: - replicas: 1 + replicas: {{ .Values.ai.replicaCount | default 1 }} selector: matchLabels: app.kubernetes.io/name: briefer diff --git a/chart/templates/api-deployment.yaml b/chart/templates/api-deployment.yaml index 1ca7cc4..56bb48c 100644 --- a/chart/templates/api-deployment.yaml +++ b/chart/templates/api-deployment.yaml @@ -7,7 +7,7 @@ metadata: app.kubernetes.io/name: briefer app.kubernetes.io/component: api spec: - replicas: 1 + replicas: {{ .Values.api.replicaCount | default 1 }} selector: matchLabels: app.kubernetes.io/name: briefer diff --git a/chart/templates/web-deployment.yaml b/chart/templates/web-deployment.yaml index f918893..1f54b4c 100644 --- a/chart/templates/web-deployment.yaml +++ b/chart/templates/web-deployment.yaml @@ -7,7 +7,7 @@ metadata: app.kubernetes.io/name: briefer app.kubernetes.io/component: web spec: - replicas: 1 + replicas: {{ .Values.web.replicaCount | default 1 }} selector: matchLabels: app.kubernetes.io/name: briefer diff --git a/chart/values.yaml b/chart/values.yaml index 08ff5a0..b3e9ae1 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -3,11 +3,12 @@ enableLocalPostgres: true ai: enabled: true + replicaCount: 1 image: repository: docker.io name: briefercloud/briefer-ai - tag: v0.0.42 + tag: v0.0.65 pullPolicy: Always resources: @@ -42,10 +43,11 @@ ai: # effect: 'NoSchedule' web: + replicaCount: 1 image: repository: docker.io name: briefercloud/briefer-web - tag: v0.0.42 + tag: v0.0.65 pullPolicy: Always # optional @@ -74,10 +76,12 @@ web: # effect: 'NoSchedule' api: + replicaCount: 1 + image: repository: docker.io name: briefercloud/briefer-api - tag: v0.0.42 + tag: v0.0.65 pullPolicy: Always resources: @@ -148,7 +152,7 @@ jupyter: image: repository: docker.io name: briefercloud/briefer-jupyter - tag: v0.0.42 + tag: v0.0.65 pullPolicy: Always # tolerations: diff --git a/docs/deployment/kubernetes.mdx b/docs/deployment/kubernetes.mdx index dfa3481..88779f7 100644 --- a/docs/deployment/kubernetes.mdx +++ b/docs/deployment/kubernetes.mdx @@ -52,11 +52,11 @@ Using Briefer's Helm chart is the easiest way of setting up Briefer on your Kube Feel free to change the namespace if you want to. If you're using an existing namespace, please remove the `--create-namespace` flag. 4. After installing Briefer's Helm chart, you can confirm that the manifests have been applied by listing all the pods in the chart's target namespace (usually `kubectl get pods -n briefer`). - If you're running a Postgres instance within your cluster, it might be that - the API will be ready before the Postgres instance is up. In that case, - you'll see that the API pod will keep restarting for a few minutes. That's - _normal_. It happens because the API needs to connect to the database to - start, so it'll just keep trying to start until Postgres is ready. + If you're running a Postgres instance within your cluster, it might be that + the API will be ready before the Postgres instance is up. In that case, + you'll see that the API pod will keep restarting for a few minutes. That's + _normal_. It happens because the API needs to connect to the database to + start, so it'll just keep trying to start until Postgres is ready. 5. Create the necessary `Ingress` resources so that you can access Briefer's API and Web containers. Make sure to use the same URLs you've configured in step 2. @@ -105,6 +105,25 @@ api: postgresPassword: password ``` +### Using more than one replica for Briefers' services + +If you want to use more than one replica for Briefer's services, you must set the `replicas` for each service in your `values.yaml` file. + +After doing that, make sure to enable sticky sessions in your `Ingress` resources. Without sticky sessions (also known as Session Affinity), Briefer will not work correctly when using multiple replicas. + +If you're using NGINX as your Ingress controller, you can enable sticky sessions by adding the annotations below to your `Ingress` resources, for example. + +```yaml +nginx.ingress.kubernetes.io/affinity: 'cookie' +nginx.ingress.kubernetes.io/session-cookie-name: 'http-cookie' +nginx.ingress.kubernetes.io/session-cookie-expires: '172800' +nginx.ingress.kubernetes.io/session-cookie-max-age: '172800' +``` + + +It's not necessary to use sticky sessions if you're using only one replica. + + ### Configuring pod sizes We recommend that you explicitly configure the size of your `jupyter` pod so that it has enough memory and vCPUs to run your analyses. From b10865d53d28695781e921510113c4595bfec9f4 Mon Sep 17 00:00:00 2001 From: Lucas Vieira Date: Thu, 28 Nov 2024 13:57:20 -0300 Subject: [PATCH 2/2] set chart version to 0.0.66 --- chart/values.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chart/values.yaml b/chart/values.yaml index b3e9ae1..d6f143a 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -8,7 +8,7 @@ ai: image: repository: docker.io name: briefercloud/briefer-ai - tag: v0.0.65 + tag: v0.0.66 pullPolicy: Always resources: @@ -47,7 +47,7 @@ web: image: repository: docker.io name: briefercloud/briefer-web - tag: v0.0.65 + tag: v0.0.66 pullPolicy: Always # optional @@ -81,7 +81,7 @@ api: image: repository: docker.io name: briefercloud/briefer-api - tag: v0.0.65 + tag: v0.0.66 pullPolicy: Always resources: @@ -152,7 +152,7 @@ jupyter: image: repository: docker.io name: briefercloud/briefer-jupyter - tag: v0.0.65 + tag: v0.0.66 pullPolicy: Always # tolerations: