Lifecycle hooks for k8s containers

There are two hooks. An action PostStart is defined before the container starts, and an action PreStop is defined before the container is closed.

Action can be a command or http request

Example

spec:
  containers:
  - lifecycle:
      preStop:
        exec:
          command:
          - curl
          - -XPOST
          - http://localhost:8080/shutdown
          - '&&'
          - sleep
          - 10s

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325252474&siteId=291194637