https://github.com/kubernetes-csi/livenessprobe
A sidecar container that can be included in a CSI plugin pod to enable integration with Kubernetes Liveness Probe.
https://github.com/kubernetes-csi/livenessprobe
k8s-sig-storage
Last synced: 6 months ago
JSON representation
A sidecar container that can be included in a CSI plugin pod to enable integration with Kubernetes Liveness Probe.
- Host: GitHub
- URL: https://github.com/kubernetes-csi/livenessprobe
- Owner: kubernetes-csi
- License: apache-2.0
- Created: 2018-03-15T21:36:47.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-29T09:07:56.000Z (about 1 year ago)
- Last Synced: 2024-04-30T07:15:15.409Z (about 1 year ago)
- Topics: k8s-sig-storage
- Language: Shell
- Homepage:
- Size: 23.3 MB
- Stars: 68
- Watchers: 10
- Forks: 90
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG/CHANGELOG-1.1.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: code-of-conduct.md
- Security: SECURITY_CONTACTS
Awesome Lists containing this project
README
# Liveness Probe
The liveness probe is a sidecar container that exposes an HTTP `/healthz`
endpoint, which serves as kubelet's [livenessProbe hook](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes)
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)](https://github.com/container-storage-interface/spec/blob/master/spec.md#probe)## Compatibility
This information reflects the head of this branch.| Compatible with CSI Version | Container Image | [Min K8s Version](https://kubernetes-csi.github.io/docs/kubernetes-compatibility.html#minimum-version) |
| ------------------------------------------------------------------------------------------ | -------------------------------------| --------------- |
| [CSI Spec v1.0.0](https://github.com/container-storage-interface/spec/releases/tag/v1.0.0) | registry.k8s.io/sig-storage/livenessprobe | 1.13 |## Usage
See [hostpath-with-livenessprobe.yaml](https://github.com/kubernetes-csi/livenessprobe/blob/master/deployment/kubernetes/livenessprobe-sidecar.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.```yaml
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
#### Recommended optional arguments
* `--csi-address `: 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 `: TCP ports for listening for healthz requests (default "9808")
* `--probe-timeout `: Maximum duration of single `Probe()` call (default "1s").
* `--metrics-address `: 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 `: The HTTP path where prometheus metrics will be exposed. Default is `/metrics`."
* `--http-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.
* [Arguments set by the `k8s.io/component-base/logs` package for klog](https://github.com/kubernetes/component-base/blob/v0.28.0-rc.0/logs/api/v1/options.go#L337-L355) are supported, such as `--v ` and `--logging-format `.
## Community, discussion, contribution, and support
Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/).
You can reach the maintainers of this project at:
* [Slack channel](https://kubernetes.slack.com/messages/sig-storage)
* [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-storage)### Code of conduct
Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).