This repository contains the code base for our SFTP server, which runs in the kubernetes cluster.
ssh
- Create ssh host keys
ssh-keygen -t ed25519 -f ssh_host_ed25519_key < /dev/null
ssh-keygen -t rsa -b 4096 -f ssh_host_rsa_key < /dev/null
docker
local
- Run
docker-compose up
- Connect to the sftp server via localhost:2222
- To shut down run
docker-compose down
registry
- Build and push the container to your registry
docker build -t YOUR_REGISTRY/sftp:TAG
docker push YOUR_REGISTRY/sftp:TAG
kubernetes
- Run
kubectl apply -f sftp-persistentvolumeclaim.yaml
once!- This will create a persistent volume and was most likely already done by someone else. Care! Here is all the data.
- Run
kubectl apply -f sftp-service.yaml
to create or update the service.- This is the "gateway" to access the sftp server remotely. If you need to change the IP, Port etc. Do your config here.
- Run
kubectl apply -f sftp-deployment.yaml
to create or update the deployment.- Here you can make changes to the running pod. You probably want to update the docker image version here.
- Create new password for user
echo -n "PASSWORD" | docker run -i --rm atmoz/makepasswd --crypt-md5 --clearfrom=-
- Add new user to
users.conf
(with encrypted password) - Add new user to
bindmount.sh
to mount the iisy dir within the users home - Build new image
docker build -t YOUR_REGISTRY/sftp:YOUR_TAG .
- Make sure to login to the registry first!
- Think about adding a new TAG. You have to change this in the kubernetes deployment as well!
- Push image to registry
docker push YOUR_REGISTRY/sftp:YOUR_TAG
- Delete old kubernetes pod
kubectl delete pod POD_NAME