I have the following manifest where I deploy and persist SFTP data for users:
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: sftp-secrets
labels:
name: sftp-alpine
namespace: mynamespace
data:
SFTP_PASSWORD_1: X
SFTP_PASSWORD_2: Y
SFTP_PASSWORD_3: Z
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: sftp-alpine
namespace: mynamespace
labels:
name: sftp-alpine
spec:
replicas: 1
selector:
matchLabels:
name: sftp-alpine
template:
metadata:
labels:
name: sftp-alpine
spec:
containers:
- name: sftp
image: sftp:v01
imagePullPolicy: Always
args: [
"user1:$(SFTP_PASSWORD_1):1001:100:data",
"user2:$(SFTP_PASSWORD_2):1002:101:data",
"user3:$(SFTP_PASSWORD_3):1003:102:data"
]
ports:
- containerPort: 22
envFrom:
- secretRef:
name: sftp-secrets
volumeMounts:
- mountPath: /home/user1/data
name: config-nas
livenessProbe:
tcpSocket:
port: 22
readinessProbe:
tcpSocket:
port: 22
resources:
requests:
cpu: 100m
memory: 500Mi
limits:
cpu: 500m
memory: 2Gi
volumes:
- name: config-nas
persistentVolumeClaim:
claimName: pv-claim
When I deploy it, SFTP server works well. For one user his data are persistent.
I would like to do it for all users, persist data for all users that have data in their folder. I tried with mountPath "/home" but my SFTP doesn't work after this modification. It connects and SFTP disconnect immediately.
How can I do to persist data for all users ?