ktm5124
ktm5124

Reputation: 12123

How can I configure a Jupyter notebook password in a YAML file?

I would like to configure the password to my Jupyter notebook in the deployment.yaml file. I run this file with kubectl. The notebook starts up fine, but the password is not set. How can I improve the yaml file to configure a password?

apiVersion: apps/v1
kind: Deployment
metadata:
  name: minimal-notebook
  labels:
    app: minimal-notebook
spec:
  replicas: 1
  selector:
    matchLabels:
      app: minimal-notebook
  template:
    metadata:
      labels:
        app: minimal-notebook
    spec:
      containers:
      - name: minimal-notebook
        image: jupyter/minimal-notebook:latest
        ports:
        - containerPort: 8888
        args: ["start-notebook.sh", "--NotebookApp.password='sha1:[password]'"]

Upvotes: 0

Views: 460

Answers (1)

joserobertog
joserobertog

Reputation: 119

In the space “[password]” on your code, you need to enter a hashed password to use for web authentication, you can prepare a hashed password manually, using the function “from notebook.auth import passwd; passwd()” in a python/IPython shell; you can use the next links as a guide to prepare the hashed password link 1 link 2 where is the next example:

from notebook.auth import passwd
passwd()
Enter password:
Verify password:
Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

If you prefer you can also use an algorithm using the next links link 3 link 4

Upvotes: 1

Related Questions