Skip to main content

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: 21
        env:
        - name: FTP_USER
          valueFrom:
            secretKeyRef:
              name: ftp-credentials
              key: FTP_USER
        - name: FTP_PASS
          valueFrom:
            secretKeyRef:
              name: ftp-credentials
              key: FTP_PASS
        volumeMounts:
        - name: backup-storage
          mountPath: /home/vsftpd
      volumes:
      - name: backup-storage
        hostPath:
          path: /mnt/introvesia_pvc01/dbs/backups
          type: Directory

---

apiVersion: v1
kind: Service
metadata:
  name: vsftpd
  namespace: ftp
spec:
  selector:
    app: vsftpd
  ports:
  - port: 21
    targetPort: 21