chr-fritz / csi-sshfs

Kubernetes CSI Plugin for SSHFS

Home Page:https://hub.docker.com/r/chrfritz/csi-sshfs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Kubernetes CSI Plugin for SSHFS

https://hub.docker.com/r/chrfritz/csi-sshfs

License:Apache License 2.0


Languages

Language:Go 93.1%Language:Dockerfile 6.9%