Installing a local FTP Server with K8S / Minikube, and accessing it with Filezilla

3/11/2020

I'm trying to install a FTP server with Kubernetes based on this repo.

I also use Traefik as Ingress.

Everything seems fine, and I can I connect FTP Server with cluster-ip, but I can't make it work with a local domain like ftp.local

Here are my K8S files:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    reloader.stakater.com/auto: "true"
  labels:
    app: ftp-local
  name: ftp-local
  namespace: influx
spec:
  selector:
    matchLabels:
      app: ftp-local
  strategy:
    type: Recreate
  replicas: 1
  template:
    metadata:
      labels:
        app: ftp-local
    spec:
      containers:
      - name: ftp-local
        image: fauria/vsftpd
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
        - containerPort: 21
          protocol: TCP
          name: "ftp-server"
        volumeMounts:
        - mountPath: "/home/vsftpd"
          name: task-pv-storage
        env:
        - name: FTP_USER
          value: "sunchain"
        - name: FTP_PASS
          value: "sunchain"
        #- name: PASV_ADDRESS
        #  value: "127.0.0.1"
        #- name: PASV_MIN_PORT
        #  value: "21100"
        #- name: PASV_MAX_PORT
        #  value: "21110"
      volumes:
      - name: task-pv-storage
        persistentVolumeClaim:
          claimName: task-pv-claim
---

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: task-pv-claim
  namespace: influx
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
---
kind: PersistentVolume
apiVersion: v1
metadata:
  name: task-pv-volume
  namespace: influx
  labels:
    type: local
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/tmp/data"
---
apiVersion: v1
kind: Service
metadata:
  name: ftp-local
  namespace: influx
  labels:
    app: ftp-local
spec:
  ports:
  - name: "21"
    port: 21
    targetPort: 21
  selector:
    app: ftp-local
  type: NodePort
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ftp-ingress
  namespace: influx
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: ftp.local
    http:
      paths:
      - backend:
         serviceName: ftp-local
         servicePort: 21

I also have a line in /etc/hosts that like that:

127.0.0.1      ftp.local

What am I missing ?

-- Juliatzin
ftp
kubernetes
kubernetes-ingress

1 Answer

3/24/2020

At first, link to repo you used was created/updated 2-3 years ago.

Many newest Kubernetes features require SSL for communication. That's the reason why SFTP is easier to apply in Kubernetes. Another thing, you are using Minikube with --driver=none which have some restrictions. All neccesary information about none driver are described here.

There was already similar question regarding FTP Filezilla in this thread.

As workaround you can consider using hostPort or hostNetwork.

Many configuration aspects depends on if you want to use Acitve or Passive FTP.

FTP requires two TCP connection to work. Second connection is established using random port. I doesn't look compatible with Services concept. SFTP requires only one connection.

As another solution you could consider use SFTP. You can find many articles in the web with information that its better to use SFTP instead of FTP. For example Tibco docs or this article

You can check Information about SFTP server using OpenSSH and try this github SFTP example.

Here you can find information abut using SFTP in FileZilla.

-- PjoterS
Source: StackOverflow