Skip to content

Docker image for K8s cronjobs to export PVCs to SMB

License

Notifications You must be signed in to change notification settings

emerconn/k8s-cronjob-smb-export

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License Docker Renovate Dashboard

k8s-cronjob-smb-export

Container image for a K8s cronJob to export a file from a PVC to an SMB share.

Usage

Expects a single directory from which the most recent file will be used.

Variables

  • SMB_USER_NAME=
  • SMB_USER_DOMAIN=
  • SMB_USER_PASSWORD=
  • SMB_SERVICE_NAME=
    • doesn't end with /
    • eg: //fileShareName/rootFolder
  • SMB_DIRECTORY=
    • doesn't start or end with /
    • eg: folder/anotherFolder/etcFolder
  • ARCHIVE_FILE_DIRECTORY=
    • does start but doesn't end with /
    • this is the directory within the PVC
    • eg: /folder/anotherFolder/etcFolder

Container Images

Hosted on ghcr.io and Docker Hub.

docker pull ghcr.io/emerconn/k8s-cronjob-smb-export
# or
docker pull emerconn/k8s-cronjob-smb-export

K8s example

apiVersion: v1
kind: ConfigMap
metadata:
  name: smb-export
data:
  ARCHIVE_FILE_DIRECTORY: /var/out-dir-example-app/instance/server/default/data/archive
  SMB_DIRECTORY: example-app/prod
  SMB_SERVICE_NAME: //fileserver.domain.com/backups
  SMB_USER_DOMAIN: .domain.com
  SMB_USER_NAME: smb_export_sa
---
apiVersion: v1
kind: Secret
metadata:
  name: smb-export
type: Opaque
stringData:
  SMB_USER_PASSWORD: p@ssword1234
---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: smb-export
spec:
  schedule: '@daily'
  timeZone: America/Chicago
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            name: smb-export
            image: emerconn/k8s-cronjob-smb-export:latest
          - envFrom:
            - configMapRef:
                name: smb-export
            - secretRef:
                name: smb-export
            volumeMounts:
            - mountPath: /var/out-dir-example-app
              name: example-app-pvc
          volumes:
          - name: example-app-pvc
            persistentVolumeClaim:
              claimName: example-app-pvc