Skip to content

Commit

Permalink
first decent readme version, add access mode to values
Browse files Browse the repository at this point in the history
  • Loading branch information
mossicrue committed Mar 30, 2021
1 parent 5bed24e commit b4f676a
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 14 deletions.
101 changes: 88 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,103 @@ Kup takes the backup of an Openshift cluster by archiving both ETCD and static p

The Kup backup process can be simplified in this step:

- Log on the openshift cluster and check master node health
1. Log on the openshift cluster and check master node health

- Run the `/usr/local/bin/cluster-backup.sh` script on a master node
2. Run the `/usr/local/bin/cluster-backup.sh` script on a master node

- Copy the archive output on a persistent volume
3. Copy the archive output on a persistent volume

### Repository Content
The Repository is formed by this elements:

- manifest: directory with all the manifest template needed by the script
- `manifest`: directory with all the manifest template needed by the script

- kup-values.conf: file with all the values to render in the template
- `kup-values.conf`: file with all the values to render in the template

- kup-render.sh: script that will render the manifest with the kup-values to create the kup-install.yaml
- `kup-render.sh`: script that will render the manifest with the kup-values to create the kup-install.yaml

## Getting Started
## Kup Installation

### Prerequisites
Before starting to render the templates and install the final yaml, it's necessary:
- add a persistent volume
- retrieve the ssh-key to access the cluster as the core user
Before starting to render the templates and install the final yaml, it's necessary to create a persistent volume and retrieve the cluster ssh key to access the nodes.

### Render the Manifest
### Add a persistent volume in the cluster
Kup need to use a persistent storage in order to store the Cluster backup in a consistent way.
Make sure to have the necessary space in the persistent volume to store all the backup you need. From my experience, one Kup backup archive takes from 15 MB to 19 MB of space.

### Installation
If you need a manifest to create the persistent volume you can use the one below as starting point.

```yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
nfs:
path: /tmp
server: 172.17.0.2
persistentVolumeReclaimPolicy: Retain
```
More infos about provisioning persistent storage are present in the [Persistent Storage pages](https://docs.openshift.com/container-platform/4.5/storage/understanding-persistent-storage.html) of the Openshift docs with all the compatible type of volume in the "Configuring Persistent Volume" section
### Retrieve the ssh key to access the cluster as the core user
Kup need to use the cluster ssh key created during the installation process in order to access the master node and run the Openshift cluster backup script.
>**Note:** If you want to add an ad-hoc key you can follow this [RedHat Solutions](https://access.redhat.com/solutions/3868301)
### Set Kup values
Once both persistent volume and cluster ssh key are ready, it's possible to render the Kup manifests by first editing the `kup-values.conf` and then running the `kup-render.sh` script.

The `kup-values.conf` file has 2 type of values:

- **mandatory**: have value setted to "change-me", must be changed for a correct one to work of Kup.

- **optional**: have a default value that can be changed with something else to customize the default Kup behavior


Mandatory values are 3, and they are:

- `KUP_RENDER_CLUSTER_SSH_KEY_PATH`: path to the openshift cluster ssh key

- `KUP_RENDER_PERSISTENT_VOLUME_NAME`: name of the persistent volume created before

- `KUP_RENDER_OPENSHIFT_VERSION`: version of the cluster, value can be in the format of `4.x` or `v4.x`

To easily retrieve the Openshift version run this command in the bastion host:
```bash
[mossicrue@bastion]$ oc version | grep "^Server"
Server Version: 4.5.8
```

The value returned is `4.5.8`, for Kup is necessary only necessary the first 2 digit, so the version to use will be `v4.5` or `4.5`

### Render the manifests
After editing all the values in the kup-values.conf it's possible to render the manifest by running the `kup-render.sh` script.

The script, as for its usage, has 2 options:

- `-f`: path to the file with the kup-values file.

- `-m`: optional, is the path to the directory with Kup's manifests.

A simple command to run for render the manifest can be

```bash
[mossicrue@bastion]$ ./kup-render.sh -f kup-values.conf
```

After the script run, it will generate a new all-in-one manifest called `kup-install.yaml`


### Apply the manifest
Once the `kup-install.yaml` file is generated you can copy it to your bastion server and create all the resources running

```bash
[mossicrue@bastion]$ oc apply -f kup-install.yaml
```

It will create all the objects needed for Kup in its project called kup-backup.
1 change: 1 addition & 0 deletions kup-values.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ KUP_RENDER_FAILURE_JOB_HISTORY="3"

# VOLUMES VALUES
KUP_RENDER_PERSISTENT_VOLUME_SIZE="100Mi"
KUP_RENDER_PERSISTENT_VOLUME_ACCESS_MODE="ReadWriteMany"
2 changes: 1 addition & 1 deletion manifest/kup-05-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: kup-backup
spec:
accessModes:
- ReadWriteMany
- ${KUP_RENDER_PERSISTENT_VOLUME_ACCESS_MODE}
resources:
requests:
storage: ${KUP_RENDER_PERSISTENT_VOLUME_SIZE}
Expand Down

0 comments on commit b4f676a

Please sign in to comment.