A sidecar container that can be included in a CSI plugin pod to enable integration with Kubernetes Liveness Probe.
Go to file
Kubernetes Prow Robot 9b46a131aa
Merge pull request #361 from jsafrane/changelog-2.16
Add changelog for 2.16
2025-05-29 04:28:17 -07:00
.github test: fix trivy action CVE-2025-22871 error 2025-04-17 14:11:38 +00:00
CHANGELOG Add changelog for 2.16 2025-05-29 12:52:45 +02:00
cmd/livenessprobe Add `-automaxprocs` flag for configuring `GOMAXPROCS` 2025-05-22 17:50:39 +02:00
deployment/kubernetes Remove duplicate failureThreshold field in yaml 2021-11-16 10:47:07 +08:00
hack Add test-logcheck as a prerequisite for the test target 2024-05-13 23:36:50 +09:00
release-tools Merge commit '05909d5633e3af5bba59780917987694d2afadc2' into update-release-tools 2025-04-17 15:04:27 +00:00
vendor Add `-automaxprocs` flag for configuring `GOMAXPROCS` 2025-05-22 17:50:39 +02:00
.cloudbuild.sh cloud build: use files from csi-release-tools 2020-06-02 20:25:29 +02:00
.gitignore build: use csi-release-tools 2019-04-11 11:43:36 +02:00
.prow.sh .prow.sh: enable Prow testing 2019-04-11 11:34:09 +02:00
CONTRIBUTING.md Fixes broken link contributor cheat sheet 2022-10-19 15:13:39 +05:30
Dockerfile Revert to multiarch distroless base image 2020-10-21 13:16:06 +00:00
Dockerfile.Windows Multi windows-distro docker build args 2021-08-02 21:28:49 +00:00
LICENSE Initial commit 2018-03-15 17:36:47 -04:00
Makefile Add test-logcheck as a prerequisite for the test target 2024-05-13 23:36:50 +09:00
OWNERS OWNERS update with aliases 2021-05-21 09:46:38 +02:00
OWNERS_ALIASES OWNERS update with aliases 2021-05-21 09:46:38 +02:00
README.md Add `-automaxprocs` flag for configuring `GOMAXPROCS` 2025-05-22 17:50:39 +02:00
SECURITY_CONTACTS Create SECURITY_CONTACTS 2018-08-08 14:08:46 -07:00
cloudbuild.yaml Squashed 'release-tools/' changes from 406a79a..0496593 2024-12-17 12:58:10 +01:00
code-of-conduct.md Code of conduct 2018-03-15 15:20:40 -07:00
go.mod Add `-automaxprocs` flag for configuring `GOMAXPROCS` 2025-05-22 17:50:39 +02:00
go.sum Add `-automaxprocs` flag for configuring `GOMAXPROCS` 2025-05-22 17:50:39 +02:00

README.md

Liveness Probe

The liveness probe is a sidecar container that exposes an HTTP /healthz endpoint, which serves as kubelet's livenessProbe hook to monitor health of a CSI driver.

The liveness probe uses Probe() call to check the CSI driver is healthy. See CSI spec for more information about Probe API call. Container Storage Interface (CSI)

Compatibility

This information reflects the head of this branch.

Compatible with CSI Version Container Image Min K8s Version
CSI Spec v1.0.0 registry.k8s.io/sig-storage/livenessprobe 1.13

Usage

See hostpath-with-livenessprobe.yaml for example how to use the liveness probe with a CSI driver. Notice that actual livenessProbe is set on the container with the CSI driver. This way, Kubernetes restarts the CSI driver container when the probe fails. The liveness probe sidecar container only provides the HTTP endpoint for the probe and does not contain livenessProbe section by itself.

kind: Pod
spec:
  containers:
  # Container with CSI driver
  - name: hostpath-driver
    image: quay.io/k8scsi/hostpathplugin:v0.2.0
    # Defining port which will be used to GET plugin health status
    # 9808 is default, but can be changed.
    ports:
    - containerPort: 9808
      name: healthz
      protocol: TCP
    # The probe
    livenessProbe:
      failureThreshold: 5
      httpGet:
        path: /healthz
        port: healthz
      initialDelaySeconds: 10
      timeoutSeconds: 3
      periodSeconds: 2
    volumeMounts:
    - mountPath: /csi
      name: socket-dir
  # ...
  # The liveness probe sidecar container
  - name: liveness-probe
    imagePullPolicy: Always
    image: registry.k8s.io/sig-storage/livenessprobe:v2.7.0
    args:
    - --csi-address=/csi/csi.sock
    volumeMounts:
    - mountPath: /csi
      name: socket-dir
    # ...

Command line options

  • --csi-address <path to CSI socket>: This is the path to the CSI driver socket inside the pod that the external-provisioner container will use to issue CSI operations (/run/csi/socket is used by default).

Other recognized arguments

  • --health-port <number>: TCP ports for listening for healthz requests (default "9808")

  • --probe-timeout <duration>: Maximum duration of single Probe() call (default "1s").

  • --metrics-address <port>: The TCP network address where the prometheus metrics endpoint will listen (example: :8080). The default is empty string, which means metrics endpoint is disabled.

  • --metrics-path <path>: The HTTP path where prometheus metrics will be exposed. Default is /metrics."

  • --http-endpoint <endpoint>: The TCP network address where the HTTP server for diagnostics, including CSI driver health check and metrics. The default is empty string, which means the server is disabled.

  • --automaxprocs: Automatically set the GOMAXPROCS environment variable to match the configured Linux container CPU quota. Defaults to false.

  • Arguments set by the k8s.io/component-base/logs package for klog are supported, such as --v <log level> and --logging-format <log format>.

Community, discussion, contribution, and support

Learn how to engage with the Kubernetes community on the community page.

You can reach the maintainers of this project at:

Code of conduct

Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.