Skip to content
Open
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
21 changes: 21 additions & 0 deletions knowledge-base/how-to-get-latest-master-etcd-backup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# How to get latest backups

## Set restic envs
export AWS_DEFAULT_REGION="eu-central-1"
export RESTIC_REPOSITORY="s3:http://127.0.0.1:9000/kubermatic-master-backups"
export AWS_ACCESS_KEY_ID="<look at minio section in values.yaml>"
export AWS_SECRET_ACCESS_KEY="<look at minio section in values.yaml>"
export RESTIC_PASSWORD="<configured in restic-config secret of backup-restic KubeOne addon>"


## Port forward minio
kubectl -n minio port-forward deployment/minio 9000:9000

## Locate latest snapshot
restic snapshots -r s3:http://127.0.0.1:9000/kubermatic-master-backups --verbose

## Unlock repo if needed
restic unlock -r s3:http://127.0.0.1:9000/kubermatic-master-backups --remove-all

## Restore latest snapshot
restic -r s3:http://127.0.0.1:9000/kubermatic-master-backups restore f2d639e3 --target ./kubermatic-master-backups/snapshot-f2d639e3 -v
106 changes: 106 additions & 0 deletions knowledge-base/how-to-migrate-minio-storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# How to migrate MinIO storage
https://docs.kubermatic.com/kubermatic/v2.23/installation/upgrading/upgrade-from-2.22-to-2.23/#minio-upgrade

## boot new deployment

Get the deployment, svc, and pvc yaml files
```bash
kubectl -n minio get deployments.apps minio -o yaml > deployment.yaml
kubectl -n minio get svc minio -o yaml > svc.yaml
kubectl -n minio get pvc minio-data -o yaml > pvc.yaml
```
Change the name of the deployment, pod spec and pvc to minio-new
But don't change the namespace!

apply them:
```bash
kubectl -n minio apply -f deployment.yaml
kubectl -n minio apply -f svc.yaml
kubectl -n minio apply -f pvc.yaml
```

## Start debug container on cluster
Copy link
Member

Choose a reason for hiding this comment

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

you could use directly the minio image as well, I using locally ofte

docker run --rm -it --network host -v "`PWD`":/data -e MC_HOST_minio=https://___ACCESS__KEX___:[email protected] --name run-2-mc --entrypoint bash minio/mc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm, i tried it but struggled to get into a shell, which is actually more convenient to do all the steps. Would be much better than needing to install something

e.g. busybox, then install mc cli

```bash
kubectl run busybox --image busybox -it --rm -- sh
```

```bash
curl https://dl.min.io/client/mc/release/linux-amd64/mc \
--create-dirs \
-o $HOME/minio-binaries/mc

chmod +x $HOME/minio-binaries/mc
export PATH=$PATH:$HOME/minio-binaries/

mc --help
```

## Setup alias

```bash
mc alias set ALIAS http://minio:9000 <access-key> <access-secret>
Copy link
Member

Choose a reason for hiding this comment

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

se above example could also get injected via env var ... just FYI

mc alias set ALIAS-NEW http://minio-new:9000 <access-key> <access-secret>
```

## Transfer config according to MinIO docs

```bash
mc admin config export ALIAS > config.txt
mc admin config import ALIAS-NEW < config.txt
mc admin service restart ALIAS-NEW
mc admin cluster bucket export ALIAS-NEW
mc admin cluster bucket import ALIAS-NEW ALIAS-NEW-bucket-metadata.zip
```


## Copy data
```bash
mc mirror --preserve --watch ALIAS ALIAS-NEW
```
This will take a while and never stop, since it waits for new data to be copied. Cancel it with ctrl+c.

Make sure that the data is copied correctly.
```
mc du ALIAS
mc du ALIAS-NEW
```
Both needs to be the same.


## Scale down both deployments
```bash
kubectl -n minio scale deployment minio --replicas=0
kubectl -n minio scale deployment minio-new --replicas=0
```

## delete old pvc
```bash
kubectl -n minio delete pvc minio-data
```

## Delete old, Rename new pvc

Use https://github.com/stackitcloud/rename-pvc

```bash
kubectl -n minio delete pvc minio-data
kubectl -n minio rename-pvc minio-data-new minio-data
```

## Change release of deployment
```bash
kubectl -n minio edit deployment minio
```

## Scale up old deployment
```bash
kubectl -n minio scale deployment minio --replicas=1
```

## Delete new deployment
```bash
kubectl -n minio delete deployment minio-new
kubectl -n minio delete svc minio-new
```