Skip to content

Commit 521fe64

Browse files
committed
Update README
Rework to look similar to the other sidecar containers.
1 parent 805568a commit 521fe64

File tree

1 file changed

+49
-81
lines changed

1 file changed

+49
-81
lines changed

README.md

Lines changed: 49 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,44 @@
11
# Liveness Probe
22

3-
## Overview
4-
5-
The purpose of liveness probe is to be able to detect liveness of CSI driver
6-
and in case of a driver's failure, report it by returning non zero return code.
7-
Livenessprobe leverages CSI Probe API call, which must be answered by CSI
8-
compatible driver.
9-
Liveness probe is meant to be used in pair with kubelet's LivenessProbe hook, which
10-
executes it periodically and check the return code. Non zero return code indicates
11-
to kubelet that pod is not healthy and kubelet schedules pod restart to recover it.
3+
The liveness probe is a sidecar container that exposes an HTTP `/healthz`
4+
endpoint, which serves as kubelet's [livenessProbe hook](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes)
5+
to monitor health of a CSI driver.
126

7+
The liveness probe uses `Probe()` call to check the CSI driver is healthy.
138
See CSI spec for more information about Probe API call.
149
[Container Storage Interface (CSI)](https://github.com/container-storage-interface/spec/blob/master/spec.md#probe)
1510

16-
## Livenessprobe
17-
18-
### Configuration Requirements
19-
20-
* -connection-timeout duration
21-
Timeout for waiting for CSI driver socket in seconds. (default 30s)
22-
* -csi-address string
23-
Address of the CSI driver socket. (default "/run/csi/socket")
24-
* -health-port string
25-
TCP ports for listening healthz requests (default "9808")
26-
27-
### Compiling
28-
29-
Livenessprobe can be compiled in a form of a binary file or in a form of a container. When compiled
30-
as a binary file, it gets stored in bin folder with the name livenessprobe. When compiled as a container,
31-
the resulting image is stored in a local docker's image store and tagged as
32-
quay.io/k8scsi/livenessprobe:canary
33-
34-
To compile just a binary file:
35-
36-
```
37-
make livenessprobe
38-
```
39-
40-
To build a container:
11+
## Compatibility
12+
This information reflects the head of this branch.
4113

42-
```
43-
make livenessprobe-container
44-
```
14+
| Compatible with CSI Version | Container Image | Min K8s Version |
15+
| ------------------------------------------------------------------------------------------ | -----------------------------| --------------- |
16+
| [CSI Spec v1.0.0](https://github.com/container-storage-interface/spec/releases/tag/v1.0.0) | quay.io/k8scsi/livenessprobe | 1.13 |
4517

46-
By running:
4718

48-
```
49-
docker images | grep livenessprobe
50-
```
51-
52-
You should see the following line in the output:
53-
54-
```
55-
quay.io/k8scsi/livenessprobe canary 8f65dd5f789a 16 hours ago 16MB
56-
```
19+
## Usage
5720

58-
### Using livenessprobe
59-
60-
Below is an example of sidecar container which needs to be added to the CSI driver yaml.
21+
See [hostpath-with-livenessprobe.yaml](deployment/kubernetes/hostpath-with-livenessprobe.yaml)
22+
for example how to use the liveness probe with a CSI driver. Notice that actual
23+
`livenessProbe` is set on the container with the CSI driver. This way, Kubernetes
24+
restarts the CSI driver container when the probe fails. The liveness probe
25+
sidecar container only provides the HTTP endpoint for the probe and does not
26+
contain `livenessProbe` section by itself.
6127

6228
```yaml
29+
kind: Pod
30+
spec:
31+
containers:
32+
# Container with CSI driver
6333
- name: hostpath-driver
6434
image: quay.io/k8scsi/hostpathplugin:v0.2.0
65-
imagePullPolicy: Always
66-
securityContext:
67-
privileged: true
68-
#
69-
# Defining port which will be used to GET plugin health status
70-
# 9808 is default, but can be changed.
71-
#
35+
# Defining port which will be used to GET plugin health status
36+
# 9808 is default, but can be changed.
7237
ports:
7338
- containerPort: 9808
7439
name: healthz
7540
protocol: TCP
41+
# The probe
7642
livenessProbe:
7743
failureThreshold: 5
7844
httpGet:
@@ -81,41 +47,43 @@ Below is an example of sidecar container which needs to be added to the CSI driv
8147
initialDelaySeconds: 10
8248
timeoutSeconds: 3
8349
periodSeconds: 2
84-
failureThreshold: 1
85-
volumeMounts:
50+
volumeMounts:
8651
- mountPath: /csi
8752
name: socket-dir
88-
- mountPath: /var/lib/kubelet/pods
89-
mountPropagation: Bidirectional
90-
name: mountpoint-dir
91-
args:
92-
- --v=5
93-
- --endpoint=$(CSI_ENDPOINT)
94-
- --nodeid=$(KUBE_NODE_NAME)
95-
env:
96-
- name: CSI_ENDPOINT
97-
value: unix:///csi/csi.sock
98-
- name: KUBE_NODE_NAME
99-
valueFrom:
100-
fieldRef:
101-
apiVersion: v1
102-
fieldPath: spec.nodeName
103-
#
104-
# Spec for liveness probe sidecar container
105-
#
53+
# ...
54+
# The liveness probe sidecar container
10655
- name: liveness-probe
10756
imagePullPolicy: Always
10857
volumeMounts:
10958
- mountPath: /csi
11059
name: socket-dir
111-
image: quay.io/k8scsi/livenessprobe:v0.2.0
60+
image: quay.io/k8scsi/livenessprobe:v1.1.0
11261
args:
11362
- --csi-address=/csi/csi.sock
114-
- --connection-timeout=3s
115-
#
116-
63+
volumeMounts:
64+
- mountPath: /csi
65+
name: socket-dir
66+
# ...
11767
```
11868

69+
### Command line options
70+
71+
#### Recommended optional arguments
72+
73+
* `--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).
74+
75+
#### Other recognized arguments
76+
77+
* `--health-port <number>`: TCP ports for listening for HTTP requests (default "9808")
78+
79+
* `--probe-timeout <duration>`: Maximum duration of single `Probe()` call (default "1s").
80+
81+
* All glog / klog arguments are supported, such as `-v <log level>` or `-alsologtostderr`.
82+
83+
#### Deprecated arguments
84+
85+
* `--connection-timeout <duration>`: This option was used to limit establishing connection to CSI driver. Currently, the option does not have any effect and the external-provisioner tries to connect to CSI driver socket indefinitely. It is recommended to run ReadinessProbe on the driver to ensure that the driver comes up in reasonable time.
86+
11987
## Community, discussion, contribution, and support
12088

12189
Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/).

0 commit comments

Comments
 (0)