aledv / kubernetes-ftp

Demo kubernetes-ftp
42 stars 57 forks source link

Data port(s)? #3

Open jnazander opened 5 years ago

jnazander commented 5 years ago

Does this example actually work? I've just tried this myself on minikube, and whenever I connect with an FTP client to my node's IP address on port 30080, it connects and starts the session successfully, but the "Reading remote directory" command times out.

I assume this is because the FTP protocol requires opening a connection on a second port (the data port). In your example config, it's chosen by vsftpd randomly from the 21100-21110 range. But your NodePort service only forwards the command port (21), not the data port, so there is no way this example could work.

Even if you would configure vsftpd to use a static data port and NodePort to forward it, there's also the problem of NodePort forwarding each new TCP connection to a different pod, so your data connection may arrive at a different pod than your control connection, and will be promptly rejected. In fact, FTP starts a new TCP connection on the data port for every file transferred!

This example doesn't resolve ANY of the above issues.

loic-lopez commented 5 years ago

Without passive mode the connection will be used by the 21 port.

Inv0k-er commented 5 years ago

And how to enable passive mode ? Because when I using comand line always OK. But when I use FileZilla I have problem Cannot get directory listing I can not view the directory '/'.

MariaPaypoint commented 11 months ago

Mode is a setting of client apps https://support.tigertech.net/filezilla-passive

mcs commented 2 weeks ago

I "think" that in reality, this won't work often as FTP clients usually are behind a firewall which shouldn't allow dynamically opened ports being accessible from the internet. So PASV mode seems to be the only reliable option if FTP needs to be offered to large parties with unknown network setups. And that is not covered with this solution.