Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update backup-restic to etcd 3.5.11 and fix addon documentation #2981

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/backups-restic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ storing backups.

You need to replace the following values with the actual ones:
* `<<RESTIC_PASSWORD>>` - a password used to encrypt the backups
* `<<S3_BUCKET>>` - the name of the S3 bucket to be used for backups
* `<<S3_BUCKET>>` - the restic-style path of the repository to be used for backups (e.g. `s3:s3.amazonaws.com/<backup-bucket-name>`)
* `<<AWS_DEFAULT_REGION>>` - default AWS region

Credentials are fetched automatically if you are deploying on AWS. If you want to use
Expand Down
35 changes: 19 additions & 16 deletions addons/backups-restic/backups-restic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,14 @@ spec:
path: /etc/kubernetes/pki
initContainers:
- name: snapshoter
image: {{ Registry "gcr.io" }}/etcd-development/etcd:v3.5.6
image: {{ Registry "gcr.io" }}/etcd-development/etcd:v3.5.11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to use k8s.gcr.io instead in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should, KKP is also still using this image.

imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- |-
set -euf
mkdir -p /backup/pki/kubernetes
mkdir -p /backup/pki/etcd
cp -a /etc/kubernetes/pki/etcd/ca.crt /backup/pki/etcd/
cp -a /etc/kubernetes/pki/etcd/ca.key /backup/pki/etcd/
cp -a /etc/kubernetes/pki/ca.crt /backup/pki/kubernetes
cp -a /etc/kubernetes/pki/ca.key /backup/pki/kubernetes
cp -a /etc/kubernetes/pki/front-proxy-ca.crt /backup/pki/kubernetes
cp -a /etc/kubernetes/pki/front-proxy-ca.key /backup/pki/kubernetes
cp -a /etc/kubernetes/pki/sa.key /backup/pki/kubernetes
cp -a /etc/kubernetes/pki/sa.pub /backup/pki/kubernetes
etcdctl snapshot save /backup/etcd-snapshot.db
- etcdctl
args:
- snapshot
- save
- /backup/etcd-snapshot.db
env:
- name: ETCDCTL_API
value: "3"
Expand Down Expand Up @@ -100,6 +90,16 @@ spec:
- -c
- |-
set -euf
mkdir -p /backup/pki/kubernetes
mkdir -p /backup/pki/etcd
cp -a /etc/kubernetes/pki/etcd/ca.crt /backup/pki/etcd/
cp -a /etc/kubernetes/pki/etcd/ca.key /backup/pki/etcd/
cp -a /etc/kubernetes/pki/ca.crt /backup/pki/kubernetes
cp -a /etc/kubernetes/pki/ca.key /backup/pki/kubernetes
cp -a /etc/kubernetes/pki/front-proxy-ca.crt /backup/pki/kubernetes
cp -a /etc/kubernetes/pki/front-proxy-ca.key /backup/pki/kubernetes
cp -a /etc/kubernetes/pki/sa.key /backup/pki/kubernetes
cp -a /etc/kubernetes/pki/sa.pub /backup/pki/kubernetes
restic snapshots -q || restic init -q
restic backup --tag=etcd --host=${ETCD_HOSTNAME} /backup
restic forget --prune --keep-last 48
Expand Down Expand Up @@ -130,3 +130,6 @@ spec:
volumeMounts:
- mountPath: /backup
name: etcd-backup
- mountPath: /etc/kubernetes/pki
name: host-pki
readOnly: true