mount secrets for jupyterhub on kubernetes with Helm

4/15/2021

I am new to Kubernetes and Helm. I deployed a jupyterhub pod on Kubernetes (on GCP) following this line

https://zero-to-jupyterhub.readthedocs.io/en/stable/jupyterhub/installation.html

  • First, I managed to get it working with simple configuration and in order to interact with GCS from the notebooks I am currently uploading a keyfile.json for each user and using environment variable GOOGLE_APPLICATION_CREDENTIALS.

  • I would like to mount the keyfile as secret in the values.yaml. How could I do that ? Basically, I would like to get rid of uploading manually the file for each user and have it mounted automatically through the yaml file.

Thanks

-- KLA
docker-secrets
google-cloud-platform
jupyterhub
kubernetes
kubernetes-helm

1 Answer

4/23/2021

I managed to get it working by adding this in yaml file. keyfile.json was created as secret named gcsfs-creds with cubectl secrets.

   extraEnv:
    GOOGLE_APPLICATION_CREDENTIALS: "/etc/secrets/keyfile.json"
   storage:
    extraVolumes:
      - name: gcsfs-creds
        secret:
          secretName: gcsfs-creds
          items:
            - key: keyfile.json
              path: keyfile.json
    extraVolumeMounts:
      - name: gcsfs-creds
        mountPath: "/etc/secrets"
        readOnly: true
-- KLA
Source: StackOverflow