Opt folder getting wiped for notebooks?

I have a custom notebook for jupyterhub on k8s.

I am also using spark and have included some useful spark jars in /opt/spark-jars so that they don’t need to be loaded from maven manually by the user.

However, once I spin up the session inside /opt there is only the default conda folder? My /opt/spark-jars folder has gone missing?

Can you explain how you’re preparing your user image to run on KubeSpawner?

Only the home folder is retained between server restarts, it is the only folder mounted to a persistent storage. The other space is temporary space, any change you make to it will be gone after you restart.

This is very similar to starting a docker container and making changes, and then shutting it down and starting it up. Changes can be retained only outside the docker container, for example if you have mounted some storage to the docker container.

You could try to make your files be stored in the home directory. You can also try making symlinks to the home directory from /opt or something - making anyone working against /opt really work with files in the home directory where they persist. And you can also mount a dedicated storage for the /opt folder or some subfolder in it etc.

I have a docker file that creates my jar folder and loads in jars like:

RUN mkdir /opt/spark-jars

RUN wget -O /opt/spark-jars/hadoop-aws-3.2.0.jar https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-aws/3.2.0/hadoop-aws-3.2.0.jar
RUN wget -O /opt/spark-jars/delta-core_2.12-1.0.0.jar https://repo1.maven.org/maven2/io/delta/delta-core_2.12/1.0.0/delta-core_2.12-1.0.0.jar

then I have kubespawner setup to load this modified image

Ah oh, i misunderstood sorry.

I’m clueless then.

If you exec a bash shell in your single user image, is the folder visible there?

Okay I tried repushing the docker image under a new tag and updating the config to use the new tag it seems like perhaps jupyterhub wasn’t checking if the image was updated previously?
I was using:

helm upgrade --cleanup-on-fail \
  --install jupyterhub jupyterhub/jupyterhub \
  --namespace jhub \
  --create-namespace \
  --version=1.1.3 \
  --timeout 10m \
  --values jupyterhub/config.yaml

to update my deployment.