Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

chr-fritz/csi-sshfs

Repository files navigation

Container Storage Interface Driver for SSHFS

Warning: This is only a proof of concept and is not actively maintained. It should not be used in production environments!

This repository contains the CSI driver for SSHFS. It allows to mount directories using a ssh connection.

Usage

Deploy the whole directory deploy/kubernetes. This installs the csi controller and node plugin and a appropriate storage class for the csi driver.

kubectl apply -f deploy/kubernetes

To use the csi driver create a persistent volume and persistent volume claim like the example one:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: data-sshfs
  labels:
    name: data-sshfs
spec:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 100Gi
  storageClassName: sshfs
  csi:
    driver: csi-sshfs
    volumeHandle: data-id
    volumeAttributes:
      server: "<HOSTNAME|IP>"
      port: "22"
      share: "<PATH_TO_SHARE>"
      privateKey: "<NAMESPACE>/<SECRET_NAME>"
      user: "<SSH_CONNECT_USERNAME>"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data-sshfs
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 100Gi
  storageClassName: sshfs
  selector:
    matchLabels:
      name: data-sshfs

Then mount the volume into a pod:

apiVersion: v1
kind: Pod
metadata:
  name: nginx 
spec:
  containers:
  - image: maersk/nginx
    imagePullPolicy: Always
    name: nginx
    ports:
    - containerPort: 80
      protocol: TCP
    volumeMounts:
      - mountPath: /var/www
        name: data-sshfs
  volumes:
  - name: data-sshfs
    persistentVolumeClaim:
      claimName: data-sshfs

Releases

No releases published

Packages

No packages published