K8S部署sftp服务

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值