Visitar URL original
how to add a volume in kubernetes · Issue #120 · emberstack/docker-sftp · GitHub
Skip to content

how to add a volume in kubernetes #120

Open

Description

@londonanthonyoleary

Hi,
unfortunately there is no default persistence i discovered for when a pod is restarted,

i created a new pvc in kubernetes called sftp-pvc. in the same namespace as the sftp service is deployed,

to use this for persistence storage, would i just add this to the values.yaml

storage:
volumeMounts: ["/data"]
volumes: ["sftp-pvc"]

Thanks

Activity

  1. romikoops commented on Jul 18, 2022

    @romikoops

    Hi. I have spent half of the day understanding how everything works and what parameters to use.

    You could use my terraform as a baseline:

    resource "kubernetes_persistent_volume_claim_v1" "sftp_storage" {
      metadata {
        name      = "sftp-storage-pvc"
        namespace = "staging"
      }
      spec {
        access_modes = ["ReadWriteOnce"]
        resources {
          requests = {
            storage = "5Gi"
          }
        }
      }
    }
    
    resource "helm_release" "sftp_server" {
      name             = "sftp"
      namespace        = "staging"
      chart            = "sftp"
      repository       = "https://emberstack.github.io/helm-charts"
      create_namespace = false
    
      values = [yamlencode(
        {
          configuration = {
            Global = {
              Chroot = {
                Directory = "%h"
                StartPath = "sftp"
              }
              Directories = ["sftp"]
            }
            Users = [
              {
                Username : data.sops_file.this.data["sftp_username"]
                Password : data.sops_file.this.data["sftp_password"]
              }
            ]
          }
          storage = {
            volumes = [
              {
                name = "sftp-storage"
                persistentVolumeClaim = {
                  claimName = "sftp-storage-pvc" # should be static, due to we use dynamic PVC
                }
              }
            ]
            volumeMounts = [
              {
                name      = "sftp-storage"
                mountPath = "/home/${data.sops_file.this.data["sftp_username"]}/sftp"
              }
            ]
          }
        }
      )]
    
    }
    
  2. Rohmilchkaese commented on Sep 19, 2024

    @Rohmilchkaese

    @romikoops thanks a lot for your work!

    sftp:
      configuration:
        Global:
          Chroot:
            Directory: "%h"
            StartPath: sftp
          Directories:
            - sftp
        Users:
          - Username: "user"
            Password: "password"
            PublicKeys:
              - "key"
            Chroot:
              Directories: "sftp"
      storage:
        volumes:
          - name: "sftp-storage"
            persistentVolumeClaim:
              claimName: "sftp-storage-pvc"
        volumeMounts:
          - name: "sftp-storage"
            mountPath: "/home/user/sftp"
    

    In case anyone wants to copy straight into a values.yaml
    Dont forget the corresponding pvc ;)

  3. added a commit that references this issue on Jul 4, 2025
  4. jortkoopmans commented on Jul 4, 2025

    @jortkoopmans

    I guess the chart could also support creating the PVC, see PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions