• pod hook 钩子函数 生命周期 lifecycle/postStart/preStop


    hook 钩子函数 生命周期 lifecycle/postStart/preStop


    hook-demo1.yaml    lifecycle/postStart
    ---
    apiVersion: v1
    kind: Pod
    metadata:
        name: hook-demo1
        labels:
            app: hook
    spec:
        containers:
        - name: hook-demo1
          image: nginx
          ports:
          - name: webport
              containerPort: 80
          lifecycle:
              postStart:
                  exec:
                      command: ["/bin/sh","-c","echo Hello from the postStart Handler > /usr/share/message"]



    hook-demo2.yaml    lifecycle/preStop
    ---
    apiVersion: v1
    kind: Pod
    metadata:
      name: hook-demo2
      labels:
        app: hook
    spec:
      containers:
      - name: hook-demo2
        image: nginx
        ports:
        - name: webport
          containerPort: 80
        volumeMounts:
        - name: message
          mountPath: /usr/share/
        lifecycle:
          preStop:
            exec:
              command: ['/bin/sh','-c','echo Hello from the preStop Handler > /usr/share/message']
      volumes:
      - name: message
        hostPath:
          path: /tmp

  • 相关阅读:
    每日日报7月15日
    每日日报7月14日
    ecplise下 java问题处理
    Visual Studio Code for .Net Framework
    Go语言操作MySQL数据库
    Go语言Gin-4中间件
    Go语言Gin-2.数据传输
    Go语言Gin-1.路由
    13.Go语言-并发编程
    12.Go语言-网络编程
  • 原文地址:https://www.cnblogs.com/walkersss/p/11754457.html
Copyright © 2020-2023  润新知