jupyterhub +jupyterlab(單機)
錯誤信息
Refused to display 'http://172.25.56.107:8000/user/wangtest/lab?'
in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'".
處理方案 https://github.com/jupyterhub/jupyterhub/issues/379
[root@test003 ~]# tail -f -n 10 jupyterhub_config.py
c.Authenticator.admin_users = {'zhishang'}
c.Spawner.default_url = '/lab'
c.Spawner.args = ['--NotebookApp.tornado_settings={"headers":{"Content-Security-Policy": "frame-ancestors * self 172.25.56.107:8000"}}']
c.JupyterHub.tornado_settings = { 'headers': { 'Content-Security-Policy': "frame-ancestors * self 172.25.56.107:8000"} }
jupyter-k8s如下
proxy:
secretToken: "461e64c9907351b6cd18152da94e49cbeb903427a74e28a7ee12e9b2f39062a2"
service:
type: NodePort
nodePorts:
http: 30080
https: 30443
hub:
uid: 1000
fsGid: 1000
image:
name: jupyterhub/k8s-hub
tag: "20200220"
db:
type: mysql
url: mysql+pymysql://root:[email protected]:3306/jupyter
extraConfig:
myConfig.py: |
c.Spawner.cmd = ['jupyter-labhub']
c.KubeSpawner.extra_pod_config = {
'hostNetwork': True,
'hostPID': True
}
c.Spawner.args = ['--NotebookApp.tornado_settings={"headers":{"Content-Security-Policy": "frame-ancestors * self tom.lab.com"}}']
c.JupyterHub.tornado_settings = { 'headers': { 'Content-Security-Policy': "frame-ancestors * self tom.lab.com"} }
singleuser:
uid: 1000
fsGid: 100
defaultUrl: "/lab"
image:
name: jupyter/all-spark-notebook
tag: '20200219_2'
storage:
type: static
static:
pvcName: "hub-db-dir"
subPath: 'home/{username}'
capacity: 20Gi
dynamic:
storageClass: "managed-nfs-storage"
storageAccessModes: [ReadWriteOnce]
extraEnv:
CHOWN_HOME: 'yes'
memory:
limit:
guarantee: 2G
auth:
type: custom
custom:
className: mysqlauthenticator.MysqlAuthenticator
whitelist:
users:
admin:
access: true
users:
- tom
- admin