From d53cdbc6a8bc5510d3275a92b16820e86ff02d73 Mon Sep 17 00:00:00 2001 From: Jonas Kaninda Date: Wed, 14 Aug 2024 21:48:49 +0200 Subject: [PATCH] docs: update kubernetes deployment --- README.md | 16 -------- docs/how-tos/backup-to-s3.md | 2 +- docs/how-tos/deploy-on-kubernetes.md | 60 +++++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index c48505a..004fe7b 100644 --- a/README.md +++ b/README.md @@ -101,9 +101,6 @@ spec: command: - bkup - backup - - --storage - - ssh - - --disable-compression resources: limits: memory: "128Mi" @@ -120,19 +117,6 @@ spec: # Please use secret! - name: DB_PASSWORD value: "" - - name: SSH_HOST_NAME - value: "xxx" - - name: SSH_PORT - value: "22" - - name: SSH_USER - value: "xxx" - - name: SSH_PASSWORD - value: "xxxx" - - name: SSH_REMOTE_PATH - value: "/home/toto/backup" - # Optional, required if you want to encrypt your backup - - name: GPG_PASSPHRASE - value: "xxxx" restartPolicy: Never ``` ## Available image registries diff --git a/docs/how-tos/backup-to-s3.md b/docs/how-tos/backup-to-s3.md index 5fe120b..7e48b11 100644 --- a/docs/how-tos/backup-to-s3.md +++ b/docs/how-tos/backup-to-s3.md @@ -85,7 +85,7 @@ networks: For Kubernetes, you don't need to run it in scheduled mode. You can deploy it as CronJob. -### Simple Kubernetes CronJob usage: +### Simple Kubernetes backup CronJob: ```yaml apiVersion: batch/v1 diff --git a/docs/how-tos/deploy-on-kubernetes.md b/docs/how-tos/deploy-on-kubernetes.md index 964e855..bef0760 100644 --- a/docs/how-tos/deploy-on-kubernetes.md +++ b/docs/how-tos/deploy-on-kubernetes.md @@ -10,7 +10,60 @@ nav_order: 8 To deploy PostgreSQL Backup on Kubernetes, you can use Job to backup or Restore your database. For recurring backup you can use CronJob, you don't need to run it in scheduled mode. as described bellow. -## Backup Job +## Backup Job to S3 Storage + +```yaml +apiVersion: batch/v1 +kind: Job +metadata: + name: backup +spec: + template: + spec: + containers: + - name: pg-bkup + # In production, it is advised to lock your image tag to a proper + # release version instead of using `latest`. + # Check https://github.com/jkaninda/pg-bkup/releases + # for a list of available releases. + image: jkaninda/pg-bkup + command: + - bkup + - backup + - --storage + - s3 + resources: + limits: + memory: "128Mi" + cpu: "500m" + env: + - name: DB_PORT + value: "5432" + - name: DB_HOST + value: "" + - name: DB_NAME + value: "" + - name: DB_USERNAME + value: "" + # Please use secret! + - name: DB_PASSWORD + value: "" + - name: AWS_S3_ENDPOINT + value: "https://s3.amazonaws.com" + - name: AWS_S3_BUCKET_NAME + value: "xxx" + - name: AWS_REGION + value: "us-west-2" + - name: AWS_ACCESS_KEY + value: "xxxx" + - name: AWS_SECRET_KEY + value: "xxxx" + - name: AWS_DISABLE_SSL + value: "false" + restartPolicy: Never +``` + +## Backup Job to SSH remote Server ```yaml apiVersion: batch/v1 @@ -181,7 +234,10 @@ spec: ``` ## Kubernetes Rootless - + +This image also supports Kubernetes security context, you can run it in Rootless environment. +It has been tested on Openshift, it works well. +Deployment on Openshift is supported, you need to remove `securityContext` section on your yaml file. ```yaml apiVersion: batch/v1