| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- # Service defined here, plus serviceName below in StatefulSet,
- # are needed only because of condition explained in
- # https://github.com/kubernetes/kubernetes/issues/69608
- kind: Service
- apiVersion: v1
- metadata:
- name: csi-hostpathplugin
- labels:
- app: csi-hostpathplugin
- spec:
- selector:
- app: csi-hostpathplugin
- ports:
- - name: dummy
- port: 12345
- ---
- kind: StatefulSet
- apiVersion: apps/v1
- metadata:
- name: csi-hostpathplugin
- spec:
- serviceName: "csi-hostpathplugin"
- # One replica only:
- # Host path driver only works when everything runs
- # on a single node. We achieve that by starting it once and then
- # co-locate all other pods via inter-pod affinity
- replicas: 1
- selector:
- matchLabels:
- app: csi-hostpathplugin
- template:
- metadata:
- labels:
- app: csi-hostpathplugin
- spec:
- containers:
- - name: node-driver-registrar
- image: quay.io/k8scsi/csi-node-driver-registrar:v1.2.0
- lifecycle:
- preStop:
- exec:
- command: ["/bin/sh", "-c", "rm -rf /registration/csi-hostpath /registration/csi-hostpath-reg.sock"]
- args:
- - --v=5
- - --csi-address=/csi/csi.sock
- - --kubelet-registration-path=/var/lib/kubelet/plugins/csi-hostpath/csi.sock
- securityContext:
- # This is necessary only for systems with SELinux, where
- # non-privileged sidecar containers cannot access unix domain socket
- # created by privileged CSI driver container.
- privileged: true
- env:
- - name: KUBE_NODE_NAME
- valueFrom:
- fieldRef:
- apiVersion: v1
- fieldPath: spec.nodeName
- volumeMounts:
- - mountPath: /csi
- name: socket-dir
- - mountPath: /registration
- name: registration-dir
- - mountPath: /csi-data-dir
- name: csi-data-dir
- - name: hostpath
- image: quay.io/k8scsi/hostpathplugin:v1.3.0-rc1
- args:
- - "--drivername=hostpath.csi.k8s.io"
- - "--v=5"
- - "--endpoint=$(CSI_ENDPOINT)"
- - "--nodeid=$(KUBE_NODE_NAME)"
- - "--maxvolumespernode=10"
- env:
- - name: CSI_ENDPOINT
- value: unix:///csi/csi.sock
- - name: KUBE_NODE_NAME
- valueFrom:
- fieldRef:
- apiVersion: v1
- fieldPath: spec.nodeName
- securityContext:
- privileged: true
- ports:
- - containerPort: 9898
- name: healthz
- protocol: TCP
- livenessProbe:
- failureThreshold: 5
- httpGet:
- path: /healthz
- port: healthz
- initialDelaySeconds: 10
- timeoutSeconds: 3
- periodSeconds: 2
- volumeMounts:
- - mountPath: /csi
- name: socket-dir
- - mountPath: /var/lib/kubelet/pods
- mountPropagation: Bidirectional
- name: mountpoint-dir
- - mountPath: /var/lib/kubelet/plugins
- mountPropagation: Bidirectional
- name: plugins-dir
- - mountPath: /csi-data-dir
- name: csi-data-dir
- - mountPath: /dev
- name: dev-dir
- - name: liveness-probe
- volumeMounts:
- - mountPath: /csi
- name: socket-dir
- image: quay.io/k8scsi/livenessprobe:v1.1.0
- args:
- - --csi-address=/csi/csi.sock
- - --connection-timeout=3s
- - --health-port=9898
- volumes:
- - hostPath:
- path: /var/lib/kubelet/plugins/csi-hostpath
- type: DirectoryOrCreate
- name: socket-dir
- - hostPath:
- path: /var/lib/kubelet/pods
- type: DirectoryOrCreate
- name: mountpoint-dir
- - hostPath:
- path: /var/lib/kubelet/plugins_registry
- type: Directory
- name: registration-dir
- - hostPath:
- path: /var/lib/kubelet/plugins
- type: Directory
- name: plugins-dir
- - hostPath:
- # 'path' is where PV data is persisted on host.
- # using /tmp is also possible while the PVs will not available after plugin container recreation or host reboot
- path: /var/lib/csi-hostpath-data/
- type: DirectoryOrCreate
- name: csi-data-dir
- - hostPath:
- path: /dev
- type: Directory
- name: dev-dir
|