k8s-sftp/ftp.yml

72 lines
1.6 KiB
YAML
Raw Normal View History

2024-04-03 16:19:49 +02:00
apiVersion: v1
kind: ConfigMap
metadata:
name: ftp
data:
# Key-value pairs can be added here
users: |
username:password
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ftp
spec:
replicas: 1
selector:
matchLabels:
app: ftp
template:
metadata:
labels:
app: ftp
spec:
containers:
- name: ftp
image: timoreymann/chrooted-ftp
ports:
- containerPort: 2022
env:
- name: BANNER
value: "Welcome to my sFTP server!"
- name: USER_FTP_POSTFIX
value: "/data"
volumeMounts:
- name: data-volume
mountPath: /data
- name: ftp
mountPath: /opt/chrooted-ftp/users
subPath: users
- name: ssh-rsa
mountPath: /opt/chrooted-ftp/ssh_hostkeys
command: ["/bin/sh", "-c", "
if [ ! -f /opt/chrooted-ftp/ssh_hostkeys/ssh_host_rsa_key ];
then cd /opt/chrooted-ftp/ssh_hostkeys/ &&
ssh-keygen -f ssh_host_rsa_key -t rsa -P ''; fi &&
cd /opt/chrooted-ftp &&
tini -- /entrypoint"]
volumes:
- name: data-volume
hostPath:
path: /home/wtfawk/k8s-ftp/data/
- name: ssh-rsa
hostPath:
path: /home/wtfawk/k8s-ftp/ssh-rsa
- name: ftp
configMap:
name: ftp
defaultMode: 0700
---
apiVersion: v1
kind: Service
metadata:
name: ftp-service
spec:
selector:
app: ftp
ports:
- name: sftp
port: 2022
targetPort: 2022
type: NodePort