Skip to content

Commit

Permalink
Adding documentation for kubernetes setup
Browse files Browse the repository at this point in the history
  • Loading branch information
v1kko authored and rcarpa committed Jan 23, 2024
1 parent 220ee9c commit 2e6a3f7
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/operator/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@ For instance, one cannot combine `poolclass = nullpool` with the `pool_size` opt

Rucio uses [Alembic](http://alembic.zzzcomputing.com/en/latest/) as a database
migration tool, which works hand-in-hand with
[SQLAlchemy](https://www.sqlalchemy.org/). Ensure that int `etc/alembic.ini` the
[SQLAlchemy](https://www.sqlalchemy.org/). Ensure that in `etc/alembic.ini` the
database connection string is is set to the same database connection string as
the `etc/rucio.cfg` and issue the following command to verify the changes to the
upgrade of the schema:

`alembic upgrade head --sql`
`alembic upgrade --sql $(alembic current | cut -d' '-f1):head`

You can edit and then apply the SQL directly on your database. We do not advise
running automatic upgrades/downgrades with alembic.
You can edit and then apply the SQL directly on your database.

`alembic upgrade head`

We do not advise running automatic upgrades/downgrades with alembic.

Notabene, schema upgrades are reserved for feature releases and will not happen
with patch releases.
Expand Down
78 changes: 78 additions & 0 deletions docs/operator/kubernetes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
id: kubernetes
title: Setting up Rucio on Kubernetes
---

## Helm Charts

Rucio has [helm charts](https://github.com/rucio/helm-charts) available to do a set up on kubernetes.

## Tutorial

A tutorial for using rucio with kubernetes can be found [here](https://github.com/rucio/k8s-tutorial/blob/master/README.md)

## Example of kubernetes deployment

[KM3NeT](https://www.km3net.org) runs rucio on kubernetes via [flux](https://fluxcd.io).
The configuration deployed on their rucio server can be found [here](https://git.km3net.de/rucio/rucio-deployment).
The documentation of how this (specific) instance can be set up can be found in the [docs](https://git.km3net.de/rucio/rucio-deployment/-/blob/main/docs/installation.md)

## Bootstrapping the database

By default no database is initialized when a new rucio installation is set up.
With this guide you can bootstrap the database on a kubernetes cluster.

Create a `init-pod.yaml` file and apply it as specified in the readme of the [k8s_tutorial](https://github.com/rucio/k8s-tutorial/blob/master/README.md), replace the `<PASSWORD>` with the secret needed to connect to the database:

```yaml
apiVersion: v1
kind: Pod
metadata:
name: init
labels:
app: rucio
spec:
restartPolicy: Never
containers:
- name: init
image: rucio/rucio-init:latest
imagePullPolicy: Always
env:
- name: RUCIO_CFG_DATABASE_DEFAULT
value: postgresql://rucio:<PASSWORD>@postgres-postgresql/rucio
- name: RUCIO_CFG_DATABASE_SCHEMA
value: test
- name: RUCIO_CFG_BOOTSTRAP_USERPASS_IDENTITY
value: tutorial
- name: RUCIO_CFG_BOOTSTRAP_USERPASS_PWD
value: secret1R
- name: RUCIO_PRINT_CFG
value: "true"
```
```
kubectl apply -f init-pod.yaml
```

## Upgrading the database

After the rucio version has been upgraded, there might be database changes
that have to be done. These can be done on the `rucio-server` pod of the cluster and
are performed with the [Alembic](http://alembic.zzzcomputing.com/en/latest/) tool.

The alembic.ini template can be found
[here](https://github.com/rucio/rucio/blob/master/alembic.ini.template).
A kubernetes+postgresql specific version can be found in the KM3NeT example
[here](https://git.km3net.de/rucio/rucio-deployment/-/blob/main/docs/alembic.ini).
Fill in the correct values before transferring the file to the `rucio-server` pod:

```
cat alembic.ini | kubectl exec -i rucio-server-<pod identifier> --container rucio-server -- tee /tmp/alembic.ini
```

Open a bash prompt on the pod

```
kubectl exec rucio-server-<pod identifier> --container rucio-server -it -- bash
```

Then perform the upgrade with the Alembic tool as described in the database [documentation](./database#upgrading-and-downgrading-the-database-schema)
1 change: 1 addition & 0 deletions website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
],
"Operator": [
"operator/setting_up_demo",
"operator/kubernetes",
"operator/installing_server",
"operator/installing_daemons",
"operator/configuration",
Expand Down

0 comments on commit 2e6a3f7

Please sign in to comment.