kubernetes - 使用 K8S / Minikube 安装本地 FTP 服务器,并使用 Filezilla 访问它
问题描述
我正在尝试基于此 repo使用 Kubernetes 安装 FTP 服务器。
我也使用 Traefik 作为 Ingress。
一切似乎都很好,我可以将 FTP 服务器与 cluster-ip 连接,但我无法使其与 ftp.local 之类的本地域一起使用
这是我的 K8S 文件:
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
我在 /etc/hosts 中也有这样一行:
127.0.0.1 ftp.local
我错过了什么?
解决方案
起初,您使用的回购链接是在2-3 年前创建/更新的。
许多最新的 Kubernetes 功能都需要SSL
通信。这就是为什么SFTP
更容易在 Kubernetes 中应用的原因。另一件事,您使用Minikube
的--driver=none
有一些限制。此处描述了有关none
驱动程序的所有必要信息。
在这个线程中已经有关于 FTP Filezilla 的类似问题。
作为解决方法,您可以考虑使用hostPort
or hostNetwork
。
许多配置方面取决于您要使用Acitve 还是 Passive FTP。
FTP 需要两个 TCP 连接才能工作。第二个连接是使用随机端口建立的。我看起来与Services
概念不兼容。SFTP
只需要一个连接。
作为另一种解决方案,您可以考虑使用SFTP
. 您可以在网络上找到许多文章,其中包含使用 SFTP 而不是 FTP 更好的信息。例如Tibco 文档或这篇文章
您可以使用 OpenSSH 查看有关 SFTP 服务器的信息并尝试这个 github SFTP 示例。
在这里您可以找到使用SFTP
in 的信息FileZilla
。
推荐阅读
- reactjs - 将formic字段的默认值设置为0,以显示字段初始值为0而不是为空
- flutter - 如何在 Flutter 上获取指南针
- java - FirebaseVisionBarcodeDetectorOptions 中的 Android 空指针异常
- excel - 如何使用 VBA Excel 中的按钮运行每个循环以进行单元格引用
- azure - Azure APIM 策略在超时的情况下将主后端 URL 故障转移到辅助
- android - 防止后台堆栈中的相同片段
- python - 如何从位于指定文件夹中的一个文件(具有任何文件名)创建熊猫数据框?
- go - 使用开发证书在golang中调用APNS的EOF错误
- flutter - 在 Flutter 中构建动态小部件
- bluetooth-lowenergy - BLE 设备可以充当信标吗