【问题标题】:use post install for pod in k8s [duplicate]在 k8s 中为 pod 使用 post install [重复]
【发布时间】:2020-01-19 22:15:39
【问题描述】:

在文档中有一个使用postStart钩子的选项,但是我们有一些很长的脚本要运行,我们该怎么做?我的意思是提供脚本并提供运行它的路径...而不是内联运行它...

apiVersion: v1
kind: Pod
metadata:
  name: lifecycle-demo
spec:
  containers:
  - name: lifecycle-demo-container
    image: nginx
    lifecycle:
      postStart:
        exec:
          command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]

【问题讨论】:

    标签: azure kubernetes


    【解决方案1】:

    你只需要提到脚本的路径,参考这个answer

    lifecycle:
          postStart:
            exec:
              command: ["/bin/sh", "-c", /opt/poststart.sh ]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-30
      • 2021-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-07
      • 2023-02-19
      相关资源
      最近更新 更多