Skip to content

Commit

Permalink
upgrade chart to support multiple replicas
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfcosta committed Nov 28, 2024
1 parent 291327a commit 2f17d1a
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 14 deletions.
4 changes: 2 additions & 2 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion chart/templates/ai-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/web-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -148,7 +152,7 @@ jupyter:
image:
repository: docker.io
name: briefercloud/briefer-jupyter
tag: v0.0.42
tag: v0.0.65
pullPolicy: Always

# tolerations:
Expand Down
29 changes: 24 additions & 5 deletions docs/deployment/kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
<Note>
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.
</Note>
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.
Expand Down Expand Up @@ -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'
```

<Note>
It's not necessary to use sticky sessions if you're using only one replica.
</Note>

### 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.
Expand Down

0 comments on commit 2f17d1a

Please sign in to comment.