I want to run a command as soon as a pod is created and starts running. I am deploying jupyterhub
but the config that I am using is:
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"]
When the pod is up and running, I am not able to see the file /usr/share/message
and hence, I deduce that the exec command is not running.
What is the right way to make this command work?
2条答案
按热度按时间7qhs6swi1#
生命周期节的正确关键字是lifecyleHooks。
以下Blob具有正确的值。
2exbekwf2#
您可以使用“lifecycleHooks”将其写出,如下所示。
请注意,这也可以用于多个命令,方法是添加以“;“
您可以在“echo”命令之后添加额外的命令。