k8s notes

64 阅读1分钟

Here are some frequently used configurations.

  1. Set some action before the pod is stopped
lifecycle:
            preStop:
              exec:
                command:
                  - sleep
                  - '10'
  1. Health check when pod is starting
readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /ping
              port: 8000
              scheme: HTTP
            initialDelaySeconds: 3
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
  1. Set the minimum resources and maximum resources limits
resources:
            limits:
              cpu: '4'
              memory: 8Gi
            requests:
              cpu: 250m