我在 VMware 虚拟机上的本地 Kubernetes 集群上使用 Helm 图表实现了 JupyterHub。我想在用户闲置一段时间后剔除他们,但似乎行不通。
来自 hub pod(pod 名为
hub-545895f988-vmj2k
)的此错误日志可能与以下内容相关:
[W 2023-11-09 01:12:59.125 JupyterHub log:191] 403 GET /hub/api/users?state=[secret] ([email protected]) 6.40ms
[E 231109 01:12:59 ioloop:923] Exception in callback functools.partial(<function cull_idle at 0x7f8cc77975e0>, url='http://localhost:8081/hub/api', api_token='1b66576c8caa43a9ae64cb419f9bf1f0', inactive_limit=3600, cull_users=False, remove_named_servers=False, max_age=0, concurrency=10, ssl_enabled=False, internal_certs_location='internal-ssl', cull_admin_users=True, api_page_size=0)
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/tornado/ioloop.py", line 921, in _run
await val
File "/usr/local/lib/python3.9/site-packages/jupyterhub_idle_culler/__init__.py", line 422, in cull_idle
async for user in fetch_paginated(req):
File "/usr/local/lib/python3.9/site-packages/jupyterhub_idle_culler/__init__.py", line 135, in fetch_paginated
response = await resp_future
File "/usr/local/lib/python3.9/site-packages/jupyterhub_idle_culler/__init__.py", line 117, in fetch
return await client.fetch(req)
tornado.httpclient.HTTPClientError: HTTP 403: Forbidden
这是我在 YAML 中的配置值:
singleuser:
storage:
capacity: 1Gi
dynamic:
storageClass: jhub-nas
extraFiles:
mountPath: /etc/jupyter/jupyter_notebook_config.json
data:
TerminalManager:
cull_inactive_timeout: 300
cull_interval: 60
MappingKernelManager:
cull_idle_timeout: 300
cull_interval: 60
cull_connected: true
cull_busy: false
hub:
service:
type: LoadBalancer
db:
type: sqlite-pvc
pvc:
storage: 10Gi
storageClassName: jhub-nas
cull:
enabled: true
timeout: 300
every: 60
我使用以下命令安装了该版本:
helm install jhub jupyterhub/jupyterhub -n jhub-ns --create-namespace --values config.yaml
我的项目也遇到同样的问题!我使用
kubectl cp jupyter-e928cdfb-2d2b2b-2d4441-2dae41-2d5e4f239780ea:/etc/jupyter/jupyter_notebook_config.json tmp.json
并从创建的容器中获取 jupyter_notebook_config.json 文件,看起来没问题。