Upgrading JupyterHub for Kubernetes#
This section covers best-practices in upgrading your JupyterHub deployment via updates to the Helm Chart.
Z2JH follows semantic versioning, with each version taking the form
Minor and patch releases should be backwards compatible, and shouldn’t require changes to your deployment.
Review the CHANGELOG to find out about new features or bug fixes that affect your deployment,
then follow helm upgrade command.
Major releases may contain breaking changes, and will often require changes to your configuration. They have dedicated instructions for upgrading your deployment in addition to the general instructions on this page.
Major helm-chart upgrades#
These steps are critical before performing a major upgrade.
Always backup your database!
Review the appropriate upgrade guide, and/or the CHANGELOG for incompatible changes and upgrade instructions.
Update your configuration accordingly.
User servers may need be stopped prior to the upgrade, or restarted after it.
If you are planning an upgrade of a critical major installation, we recommend you test the upgrade out on a staging cluster first before applying it to production.
helm upgrade command#
After modifying your
config.yaml file according to the CHANGELOG, you will need
<helm-release-name> to run the upgrade commands. To find
helm list --namespace <k8s-namespace>
Make sure to test the upgrade on a staging environment before doing the upgrade on a production system!
To run the upgrade:
helm upgrade --cleanup-on-fail <helm-release-name> jupyterhub/jupyterhub --version=<chart-version> --values config.yaml --namespace <k8s-namespace>
For example, to upgrade to version
1.1.1 with a helm release name of
jhub in the k8s namespace of
helm upgrade --cleanup-on-fail jhub jupyterhub/jupyterhub --version=1.1.1 --values config.yaml --namespace jhub
Major releases of Z2JH may include a major release of JupyterHub that requires an upgrade of the database schema.
If you are using the default database provider (SQLite), then the required db upgrades
will be performed automatically when you do a
A backup of the old database is automatically created on the hub volume.
It is not possible to automatically backup other database providers, so the upgrade is not done automatically.
Default (SQLite): The database upgrade will be performed automatically when you perform the upgrade
MySQL / PostgreSQL: You will execute the following steps, which includes a manual update of your database:
Make a full backup of your database, just in case things go bad.
Make sure that the database user used by JupyterHub to connect to your database can perform schema migrations like adding new tables, altering tables, etc.
config.yaml, add the following config:
hub: db: upgrade: true
helm upgrade. This should perform the database upgrade needed.
Remove the lines added in step 3, and do another
helm upgradeso that future JupyterHub upgrades don’t inadvertently upgrade the schema.
Custom Docker Images: JupyterHub version match#
If you are using a custom built image, make sure that the version of the JupyterHub package installed in it matches the major version of JupyterHub, current 2.*.
For example, if you are using
pip to install JupyterHub in your custom Docker Image,
you would use:
RUN pip install --no-cache-dir jupyterhub==2.3.1
If you are using conda or mamba:
RUN conda install --channel=conda-forge -y jupyterhub-base=2.3.1
Update the configuration to use this new image, which is typically done via
singleuser.image or as part of
JupyterHub versions installed in each Helm Chart#
Each Helm Chart is packaged with a specific version of JupyterHub (and other software as well). See the Helm Chart repository for information about the versions of relevant software packages.
If the upgrade is failing on a test system or a system that does not serve users, you can try deleting the helm chart using:
helm delete <helm-release-name> --namespace <k8s-namespace>
helm list --namespace <k8s-namespace> may be used to find