sftp.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: sftp
spec:
replicas: 1 #可自行修改副本的个数
selector:
matchLabels:
app: sftp
template:
metadata:
labels:
app: sftp
spec:
containers:
- command: ["/entrypoint", "$(user):$(passwd):::$(path)"]
image: atmoz/sftp:alpine
name: sftp
env:
- name: TZ
value: "CST-8"
- name: user
value: "sftp"
- name: passwd
value: "123456"
- name: path
value: "upload"
resources:
limits:
cpu: "1"
memory: 200Mi
requests:
cpu: "0.5"
memory: 100Mi
volumeMounts:
- mountPath: /etc/ssh/ssh_host_ed25519_key
name: ssh-host-ed25519-key
- mountPath: /etc/ssh/ssh_host_rsa_key
name: ssh-host-rsa-key
volumes:
- hostPath:
path: /etc/ssh/ssh_host_ed25519_key
name: ssh-host-ed25519-key
- hostPath:
path: /etc/ssh/ssh_host_rsa_key
name: ssh-host-rsa-key
sftp根据需要创建Service Nodeport
sftp-service.yaml
apiVersion: v1
kind: Service
metadata:
name: sftp
labels:
app: sftp
spec:
type: NodePort
ports:
- port: 22
nodePort: 30022
targetPort: 22
protocol: TCP
selector:
app: sftp
kubectl create -f sftp.yaml
kubectl create -f sftp-service.yaml
查看状态
kubectl get pod,service
5、链接测试
上filezilla验证sftp链接
这里我们直接使用node1的ip地址以及在service文件中配置的30022端口链接
用户名:sftp
密码:123456
EvYx7-1679541586823)]
5、链接测试
上filezilla验证sftp链接
这里我们直接使用node1的ip地址以及在service文件中配置的30022端口链接
用户名:sftp
密码:123456
原文链接:https://blog.csdn.net/weixin_46053709/article/details/129727231