Launching ProFtpd with Kubernetes: Issue mounting volumes

10/3/2019

I would like to run a lcoal FTP server ProFtpd with minikube with docker image : vipconsult/proftpd

Here is my deployment file:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    reloader.stakater.com/auto: "true"
  name: ftp-local
  namespace: influx
  labels:
    app: ftp-local
    component: core
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: ftp-local
        component: core
    spec:
      initContainers:
      containers:
      - image: vipconsult/proftpd
        name: ftp-local
        imagePullPolicy: IfNotPresent
        # env:
        resources:
          # keep request = limit to keep this container in guaranteed class
          limits:
            cpu: 100m
            memory: 100Mi
          requests:
            cpu: 100m
            memory: 100Mi
        env:
          - name: USERNAME
            value: test
          - name: PASSWORD
            value: test
        volumeMounts:
        - name: ftp-persistent-storage
          mountPath: /var/lib/ftp

      volumes:
      - name: ftp-persistent-storage
        persistentVolumeClaim:
          claimName: ftp-storage

and volume file:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: ftp-storage
  namespace: influx
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  claimRef:
    namespace: influx
    name: ftp-storage
  hostPath:
    path: /data/ftp/storage
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: ftp-storage
  namespace: influx
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

When I deploy it, I have:

➜  proFTP git:(master) ✗ kubectl logs -n influx ftp-local-58d5d774d-zdztf                
chown: cannot access '/etc/proftpd/ftpd.passwd': No such file or directory

Documentation states:

to make the users persistent share the passwords file with the host or a data -v /home/docker/proftpd/ftpd.passwd:/etc/proftpd/ftpd.passwd

so, I tried to mount this file:

deployment ( just showing volume section )

 volumeMounts:
        - name: ftp-persistent-storage
          mountPath: /var/lib/ftp
        - name: ftp-persistent-users
          mountPath: /etc/proftpd/ftpd.passwd
          subPath: ftpd.passwd          

      volumes:
      - name: ftp-persistent-storage
        persistentVolumeClaim:
          claimName: ftp-storage
      - name: ftp-persistent-users
        persistentVolumeClaim:
          claimName: ftp-storage-users

and volumes:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: ftp-storage
  namespace: influx
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  claimRef:
    namespace: influx
    name: ftp-storage
  hostPath:
    path: /data/ftp/storage
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: ftp-storage-user
  namespace: influx
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  claimRef:
    namespace: influx
    name: ftp-storage-user
  hostPath:
    path: /data/ftp/config
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: ftp-storage
  namespace: influx
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: ftp-storage-user
  namespace: influx
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

First I am a bit frustrated to use a 1GB volume for a single file, and then I get:

proFTP git:(master) ✗ kubectl logs -n influx ftp-local-67cfd77497-7rt5m                
2019-10-03 07:35:23,853 ftp-local-67cfd77497-7rt5m proftpd[1]: mod_auth_file/1.0: unable to use AuthUserFile '/etc/proftpd/ftpd.passwd': Is a directory
2019-10-03 07:35:23,853 ftp-local-67cfd77497-7rt5m proftpd[1]: fatal: AuthUserFile: unable to use /etc/proftpd/ftpd.passwd: Is a directory on line 193 of '/etc/proftpd/proftpd.conf'

Here are my volumes:

   git:(devops) ✗ kubectl get pv,pvc -n influx            
NAME                                        CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                              STORAGECLASS   REASON   AGE
persistentvolume/ftp-storage                1Gi        RWO            Retain           Bound    influx/ftp-storage                                         22s
persistentvolume/ftp-storage-user           1Gi        RWO            Retain           Bound    influx/ftp-storage-user                                    22s

NAME                                          STATUS   VOLUME                   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
persistentvolumeclaim/ftp-storage             Bound    ftp-storage              1Gi        RWO            standard       22s
persistentvolumeclaim/ftp-storage-user        Bound    ftp-storage-user         1Gi        RWO            standard       22s

Now describing PVs:

➜  git:(devops) ✗ kubectl describe pv -n influx ftp-storage
Name:            ftp-storage
Labels:          <none>
Annotations:     kubectl.kubernetes.io/last-applied-configuration:
                   {"apiVersion":"v1","kind":"PersistentVolume","metadata":{"annotations":{},"name":"ftp-storage"},"spec":{"accessModes":["ReadWriteOnce"],"c...
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    
Status:          Bound
Claim:           influx/ftp-storage
Reclaim Policy:  Retain
Access Modes:    RWO
VolumeMode:      Filesystem
Capacity:        1Gi
Node Affinity:   <none>
Message:         
Source:
    Type:          HostPath (bare host directory volume)
    Path:          /data/ftp/storage
    HostPathType:  
Events:            <none>
➜  git:(devops) ✗ kubectl describe pv -n influx ftp-storage-user 
Name:            ftp-storage-user
Labels:          <none>
Annotations:     kubectl.kubernetes.io/last-applied-configuration:
                   {"apiVersion":"v1","kind":"PersistentVolume","metadata":{"annotations":{},"name":"ftp-storage-user"},"spec":{"accessModes":["ReadWriteOnce...
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    
Status:          Bound
Claim:           influx/ftp-storage-user
Reclaim Policy:  Retain
Access Modes:    RWO
VolumeMode:      Filesystem
Capacity:        1Gi
Node Affinity:   <none>
Message:         
Source:
    Type:          HostPath (bare host directory volume)
    Path:          /data/ftp/config
    HostPathType:  
Events:            <none>

What am I doing wrong ?

-- Juliatzin
docker
kubernetes

0 Answers