Merhaba, database ve/veya yedeğinin alınması gereken dosyalarınızı kubernetes üzerinde cronjob’a bağlayarak schedule edebilir, anlık olarak da job başlatabilirsiniz,
K8s to s3 db dump
jobs: # database dump to s3 bucket - name: customer-dbdump schedule: "5 */3 * * *" podSecurityContext: {} containerSecurityContext: {} image: repository: image/aws-cli command: ["/bin/bash", "-c" ] args: - mysqldump --column-statistics=0 -h $DB_HOST -u root -p"$DB_ROOT_PASS" $DB_NAME | gzip -9 | aws s3 cp - s3://${AWS_S3_BUCKET}/PWD/-$(date +%Y%m%d-%H-%M).sql.gz extraEnvVarsCM: env-vars extraEnvVarsSecret: env-vars-secret extraEnvVarsSecret2: env-vars-secret-for-s3
K8s to s3 media dump
jobs: # media dump - name: customer-media-dump schedule: "10 1 * * *" podSecurityContext: {} containerSecurityContext: {} image: repository: image/aws-cli command: ["/bin/bash", "-c" ] args: - tar zc /mnt/media | aws s3 cp - s3://${AWS_S3_BUCKET}PWD/-$(date +%Y%m%d-%H%M).tar.gz extraEnvVarsSecret2: env-vars-secret-for-s3 volumeMounts: - mountPath: /mnt/media name: media volumes: - name: media persistentVolumeClaim: claimName: media
S3 to k8s db import
jobs: # database dump to s3 bucket - name: customer-dbimport #At minute 1 in January.next at 2023-01-01 00:01:00 schedule: "1 * * 1 *" podSecurityContext: {} containerSecurityContext: {} image: repository: image/aws-cli command: ["/bin/bash", "-c" ] args: - aws s3 cp s3:/PWD/$(aws s3 ls PWD/ |tail -n 1 | awk '{print $4}') - | gzip -d | mysql -h $DB_HOST -u root -p"$DB_ROOT_PASS" $DB_NAME extraEnvVarsCM: env-vars extraEnvVarsSecret: env-vars-secret extraEnvVarsSecret2: env-vars-secret-for-s3
S3 to k8s media import
jobs: # media dump - name: customer-media-import #At minute 1 in January.next at 2023-01-01 00:01:00 schedule: "1 * * 1 *" podSecurityContext: {} containerSecurityContext: {} image: repository: mnmtech/aws-cli command: ["/bin/bash", "-c" ] args: - aws s3 cp s3://PWD/$(aws s3 ls PWD/ | tail -n 1 | awk '{print $4}') - | tar -zxv --strip-components=2 -C /mnt/media extraEnvVarsSecret2: env-vars-secret-for-s3 volumeMounts: - mountPath: /mnt/media name: media volumes: - name: media persistentVolumeClaim: claimName: media