部署jupyterhub时​​无法从config.yaml运行生命周期命令

时间:2019-05-16 13:57:01

标签: docker kubernetes jupyter-notebook jupyter kubernetes-helm

我想在Pod创建并开始运行后立即运行命令。我正在部署jupyterhub,但是我正在使用的配置是:

proxy:
  secretToken: "yada yada"
singleuser:
  image:
    # Get the latest image tag at:
    # https://hub.docker.com/r/jupyter/datascience-notebook/tags/
    # Inspect the Dockerfile at:
    # https://github.com/jupyter/docker-stacks/tree/master/datascience-notebook/Dockerfile
    name: jupyter/datascience-notebook
    # name: ${IMAGE}
    tag: 177037d09156
    # tag: latest
  lifecycle:
    postStart:
      exec:
        command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]

当Pod启动并运行时,我看不到文件/usr/share/message,因此推断出exec命令未运行。

使此命令起作用的正确方法是什么?

1 个答案:

答案 0 :(得分:2)

生命周期节的正确密钥是 lifecyleHooks

以下blob具有正确的值。

proxy:
  secretToken: "yada yada"
singleuser:
  image:
    # Get the latest image tag at:
    # https://hub.docker.com/r/jupyter/datascience-notebook/tags/
    # Inspect the Dockerfile at:
    # https://github.com/jupyter/docker-stacks/tree/master/datascience-notebook/Dockerfile
    name: jupyter/datascience-notebook
    # name: ${IMAGE}
    tag: 177037d09156
    # tag: latest
  lifecycleHooks:
    postStart:
      exec:
        command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]