Skip to content

Commit 486074d

Browse files
authored
Merge pull request #29 from pohly/deployment
deployment enhancements
2 parents c07eae1 + bcd0535 commit 486074d

21 files changed

+644
-78
lines changed

README.md

+25-9
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,62 @@ This repository hosts the CSI Hostpath driver and all of its build and dependent
88
- Access to terminal with `kubectl` installed
99

1010
## Deployment
11-
The easiest way to test the Hostpath driver is to run `deploy/deploy-hostpath.sh` script as shown:
11+
The easiest way to test the Hostpath driver is to run the `deploy-hostpath.sh` script for the Kubernetes version used by
12+
the cluster as shown below for Kubernetes 1.13. This creates the deployment that is maintained specifically for that
13+
release of Kubernetes. However, other deployments may also work. For details see the individual READMEs.
1214

1315
```shell
14-
$ deploy/deploy-hostpath.sh
16+
$ deploy/kubernetes-1.13/deploy-hostpath.sh
1517
```
1618

1719
You should see an output similar to the following printed on the terminal showing the application of rbac rules and the result of deploying the hostpath driver, external provisioner, external attacher and snapshotter components:
1820

1921
```shell
2022
applying RBAC rules
23+
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-provisioner/v1.0.1/deploy/kubernetes/rbac.yaml
2124
serviceaccount/csi-provisioner created
2225
clusterrole.rbac.authorization.k8s.io/external-provisioner-runner created
2326
clusterrolebinding.rbac.authorization.k8s.io/csi-provisioner-role created
2427
role.rbac.authorization.k8s.io/external-provisioner-cfg created
2528
rolebinding.rbac.authorization.k8s.io/csi-provisioner-role-cfg created
29+
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-attacher/v1.0.1/deploy/kubernetes/rbac.yaml
2630
serviceaccount/csi-attacher created
2731
clusterrole.rbac.authorization.k8s.io/external-attacher-runner created
2832
clusterrolebinding.rbac.authorization.k8s.io/csi-attacher-role created
2933
role.rbac.authorization.k8s.io/external-attacher-cfg created
3034
rolebinding.rbac.authorization.k8s.io/csi-attacher-role-cfg created
35+
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v1.0.1/deploy/kubernetes/rbac.yaml
3136
serviceaccount/csi-snapshotter created
3237
clusterrole.rbac.authorization.k8s.io/external-snapshotter-runner created
3338
clusterrolebinding.rbac.authorization.k8s.io/csi-snapshotter-role created
3439
deploying hostpath components
40+
deploy/kubernetes-1.13/hostpath/csi-hostpath-attacher.yaml
41+
using image: quay.io/k8scsi/csi-attacher:v1.0.1
3542
service/csi-hostpath-attacher created
3643
statefulset.apps/csi-hostpath-attacher created
44+
deploy/kubernetes-1.13/hostpath/csi-hostpath-plugin.yaml
45+
using image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2
46+
using image: quay.io/k8scsi/hostpathplugin:v1.0.1
47+
using image: quay.io/k8scsi/livenessprobe:v1.0.2
48+
service/csi-hostpathplugin created
3749
statefulset.apps/csi-hostpathplugin created
50+
deploy/kubernetes-1.13/hostpath/csi-hostpath-provisioner.yaml
51+
using image: quay.io/k8scsi/csi-provisioner:v1.0.1
3852
service/csi-hostpath-provisioner created
3953
statefulset.apps/csi-hostpath-provisioner created
40-
deploying snapshotter
41-
volumesnapshotclass.snapshot.storage.k8s.io/csi-hostpath-snapclass created
54+
deploy/kubernetes-1.13/hostpath/csi-hostpath-snapshotter.yaml
55+
using image: quay.io/k8scsi/csi-snapshotter:v1.0.1
4256
service/csi-hostpath-snapshotter created
4357
statefulset.apps/csi-hostpath-snapshotter created
58+
deploy/kubernetes-1.13/hostpath/csi-hostpath-testing.yaml
59+
using image: alpine/socat:1.0.3
60+
service/hostpath-service created
61+
statefulset.apps/csi-hostpath-socat created
62+
23:16:10 waiting for hostpath deployment to complete, attempt #0
63+
deploying snapshotclass
64+
volumesnapshotclass.snapshot.storage.k8s.io/csi-hostpath-snapclass created
4465
```
4566

46-
The script can also install CRDs that are needed for alpha features,
47-
but as this is something that should be done by the cluster
48-
provisioning tool it is disabled in the script by default. For this
49-
and other customizations see the source code of the deploy script.
50-
5167
The [livenessprobe side-container](https://github.com/kubernetes-csi/livenessprobe) provided by the CSI community is deployed with the CSI driver to provide the liveness checking of the CSI services.
5268

5369
## Run example application and validate

deploy/deploy-hostpath.sh

-49
This file was deleted.

deploy/kubernetes-1.13/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The deployment for Kubernetes 1.13 uses CSI 1.0 and thus is
2+
incompatible with older Kubernetes releases.
3+
4+
The sidecar images rely on the CRDs for CSIDriverInfo and CSINodeInfo,
5+
which were replaced with builtin APIs in Kubernetes 1.14. They can be
6+
deployed on Kubernetes 1.14 if the CRDs are installed, but features
7+
relying on these CRDs (like topology) are unlikely to work.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../util/deploy-hostpath.sh

deploy/hostpath/csi-hostpath-attacher.yaml renamed to deploy/kubernetes-1.13/hostpath/csi-hostpath-attacher.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,9 @@ spec:
4141
containers:
4242
- name: csi-attacher
4343
image: quay.io/k8scsi/csi-attacher:v1.0.1
44-
imagePullPolicy: Always
4544
args:
4645
- --v=5
47-
- --csi-address=$(ADDRESS)
48-
env:
49-
- name: ADDRESS
50-
value: /csi/csi.sock
46+
- --csi-address=/csi/csi.sock
5147
volumeMounts:
5248
- mountPath: /csi
5349
name: socket-dir

deploy/hostpath/csi-hostpath-plugin.yaml renamed to deploy/kubernetes-1.13/hostpath/csi-hostpath-plugin.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ spec:
3838
containers:
3939
- name: node-driver-registrar
4040
image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2
41-
imagePullPolicy: Always
4241
lifecycle:
4342
preStop:
4443
exec:
@@ -77,7 +76,6 @@ spec:
7776
fieldRef:
7877
apiVersion: v1
7978
fieldPath: spec.nodeName
80-
imagePullPolicy: Always
8179
securityContext:
8280
privileged: true
8381
ports:

deploy/hostpath/csi-hostpath-provisioner.yaml renamed to deploy/kubernetes-1.13/hostpath/csi-hostpath-provisioner.yaml

+3-7
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,9 @@ spec:
4242
- name: csi-provisioner
4343
image: quay.io/k8scsi/csi-provisioner:v1.0.1
4444
args:
45-
- "--provisioner=csi-hostpath"
46-
- "--csi-address=$(ADDRESS)"
47-
- "--connection-timeout=15s"
48-
env:
49-
- name: ADDRESS
50-
value: /csi/csi.sock
51-
imagePullPolicy: Always
45+
- -v=5
46+
- --csi-address=/csi/csi.sock
47+
- --connection-timeout=15s
5248
volumeMounts:
5349
- mountPath: /csi
5450
name: socket-dir

deploy/snapshotter/csi-hostpath-snapshotter.yaml renamed to deploy/kubernetes-1.13/hostpath/csi-hostpath-snapshotter.yaml

+3-6
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,9 @@ spec:
4242
- name: csi-snapshotter
4343
image: quay.io/k8scsi/csi-snapshotter:v1.0.1
4444
args:
45-
- "--csi-address=$(ADDRESS)"
46-
- "--connection-timeout=15s"
47-
env:
48-
- name: ADDRESS
49-
value: /csi/csi.sock
50-
imagePullPolicy: Always
45+
- -v=5
46+
- --csi-address=/csi/csi.sock
47+
- --connection-timeout=15s
5148
volumeMounts:
5249
- mountPath: /csi
5350
name: socket-dir
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# WARNING: this is only for testing purposes. Do not install in a production
2+
# cluster.
3+
#
4+
# This exposes the hostpath's Unix domain csi.sock as a TCP port to the
5+
# outside world. The mapping from Unix domain socket to TCP is done
6+
# by socat.
7+
#
8+
# This is useful for testing with csi-sanity or csc.
9+
10+
apiVersion: v1
11+
kind: Service
12+
metadata:
13+
name: hostpath-service
14+
spec:
15+
type: NodePort
16+
selector:
17+
app: csi-hostpath-socat
18+
ports:
19+
- port: 10000 # fixed port inside the pod, dynamically allocated port outside
20+
---
21+
kind: StatefulSet
22+
apiVersion: apps/v1
23+
metadata:
24+
name: csi-hostpath-socat
25+
spec:
26+
serviceName: "csi-hostpath-socat"
27+
replicas: 1
28+
selector:
29+
matchLabels:
30+
app: csi-hostpath-socat
31+
template:
32+
metadata:
33+
labels:
34+
app: csi-hostpath-socat
35+
spec:
36+
affinity:
37+
podAffinity:
38+
requiredDuringSchedulingIgnoredDuringExecution:
39+
- labelSelector:
40+
matchExpressions:
41+
- key: app
42+
operator: In
43+
values:
44+
- csi-hostpathplugin
45+
topologyKey: kubernetes.io/hostname
46+
containers:
47+
- name: socat
48+
image: alpine/socat:1.0.3
49+
args:
50+
- tcp-listen:10000,fork,reuseaddr
51+
- unix-connect:/csi/csi.sock
52+
volumeMounts:
53+
- mountPath: /csi
54+
name: socket-dir
55+
volumes:
56+
- hostPath:
57+
path: /var/lib/kubelet/plugins/csi-hostpath
58+
type: DirectoryOrCreate
59+
name: socket-dir

deploy/kubernetes-1.14

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
master

deploy/kubernetes-latest

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kubernetes-1.14

deploy/master/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
The deployment for master uses CSI 1.0 and thus is incompatible with
2+
Kubernetes < 1.13.
3+
4+
It uses the APIs for CSIDriverInfo and CSINodeInfo that were
5+
introduced in Kubernetes 1.14, so features depending on those (like
6+
topology) will not work on Kubernetes 1.13. But because this example
7+
deployment does not enable those features, it can run on Kubernetes
8+
1.13.
9+
10+
WARNING: this example uses the "canary" images. It can break at any
11+
time.

deploy/master/deploy-hostpath.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../util/deploy-hostpath.sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: csi-hostpath-attacher
5+
labels:
6+
app: csi-hostpath-attacher
7+
spec:
8+
selector:
9+
app: csi-hostpath-attacher
10+
ports:
11+
- name: dummy
12+
port: 12345
13+
14+
---
15+
kind: StatefulSet
16+
apiVersion: apps/v1
17+
metadata:
18+
name: csi-hostpath-attacher
19+
spec:
20+
serviceName: "csi-hostpath-attacher"
21+
replicas: 1
22+
selector:
23+
matchLabels:
24+
app: csi-hostpath-attacher
25+
template:
26+
metadata:
27+
labels:
28+
app: csi-hostpath-attacher
29+
spec:
30+
affinity:
31+
podAffinity:
32+
requiredDuringSchedulingIgnoredDuringExecution:
33+
- labelSelector:
34+
matchExpressions:
35+
- key: app
36+
operator: In
37+
values:
38+
- csi-hostpathplugin
39+
topologyKey: kubernetes.io/hostname
40+
serviceAccountName: csi-attacher
41+
containers:
42+
- name: csi-attacher
43+
image: quay.io/k8scsi/csi-attacher:canary # TODO: replace with released version
44+
args:
45+
- --v=5
46+
- --csi-address=/csi/csi.sock
47+
volumeMounts:
48+
- mountPath: /csi
49+
name: socket-dir
50+
51+
volumes:
52+
- hostPath:
53+
path: /var/lib/kubelet/plugins/csi-hostpath
54+
type: DirectoryOrCreate
55+
name: socket-dir

0 commit comments

Comments
 (0)