Azure 对k8s中的pod使用后安装

Azure 对k8s中的pod使用后安装,azure,kubernetes,Azure,Kubernetes,在文档中有一个使用postStarthook的选项,但是我们有一些很长的脚本要运行,我们怎么做?我的意思是提供脚本并提供运行它的路径。。。而不是内联运行它 apiVersion: v1 kind: Pod metadata: name: lifecycle-demo spec: containers: - name: lifecycle-demo-container image: nginx lifecycle: postStart: ex

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

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"]


您只需要提到脚本的路径,请参阅

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