Write FTP Service
apiVersion: v1
kind: Namespace
metadata:
name: ftp
---
apiVersion: v1
kind: Secret
metadata:
name: ftp-credentials
namespace: ftp
type: Opaque
stringData:
FTP_USER: ftpuser
FTP_PASS: your-secure-ftp-password
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: vsftpd
namespace: ftp
spec:
replicas: 1
selector:
matchLabels:
app: vsftpd
template:
metadata:
labels:
app: vsftpd
spec:
containers:
- name: vsftpd
image: fauria/vsftpd
ports:
- containerPort: 20
name: ftp-data
- containerPort: 21
name: ftp-control
- containerPort: 21100
name: ftp-pasv-min
- containerPort: 21101
name: ftp-pasv-max
env:
- name: FTP_USER
valueFrom:
secretKeyRef:
name: ftp-credentials
key: FTP_USER
- name: FTP_PASS
valueFrom:
secretKeyRef:
name: ftp-credentials
key: FTP_PASS
- name: PASV_MIN_PORT
value: "21100"
- name: PASV_MAX_PORT
value: "21101"
volumeMounts:
- name: ftp-storage
mountPath: /home/vsftpd
- name: backup-storage
mountPath: /backups
volumes:
- name: ftp-storage
emptyDir: {}
- name: backup-storage
hostPath:
path: /mnt/introvesia_pvc01/dbs/backups
type: Directory
---
apiVersion: v1
kind: Service
metadata:
name: vsftpd
namespace: ftp
spec:
type: LoadBalancer
ports:
- port: 21
targetPort: 21
name: ftp-control
- port: 20
targetPort: 20
name: ftp-data
- port: 21100
targetPort: 21100
name: ftp-pasv-min
- port: 21101
targetPort: 21101
name: ftp-pasv-max
selector:
app: vsftpd