Skip to main content
Version: 1.15.0

Create Replication Slices

This topic describes how to create a replication slice and a replication job for replicating applications.

Overview

Replication slice is a new type of slice within the KubeSlice platform. It is designed specifically for efficiently transferring some (or all) applications/resources from one cluster to another (regardless of the cloud or data center location of the clusters). After the replication is complete, the replicated applications may be integrated into an application slice if they want to continue to communicate with applications/resources that remain in the original cluster. To learn more, see the replication slice.

info

A replication slice can contain only one source and one destination worker clusters.

Create the Replication Slice YAML File

Create a replication slice YAML configuration file using the following template. For example, let us call the configuration file as replication-slice.yaml.

info

A replication slice can contain only one source and one worker cluster in it.

You can also specify source and destination as the same cluster when you want to backup the data and restore it later.

note

To know more about the configuration details, see slice parameters

apiVersion: controller.kubeslice.io/v1alpha1
kind: ReplicationSlice
metadata:
name: boutique-replication
namespace: kubeslice-avesha
spec:
destinationCluster: worker-2
sourceCluster: worker-1
minIOBucketName: boutique-replication

Apply the Replication Slice YAML File

Apply the replication slice configuration on the controller cluster. Use this command to apply the replication slice configuration on the project namespace:

kubectl apply -f <replication slice configuration>.yaml -n <project namespace>

Where:

  • <replication slice configuration>.yaml is the name of the YAML file that you created for the replication slice.
  • <project namespace> is the namespace that you have created a project.

Validate the Replication Slice on the Controller Cluster

Use the following command to validate the slice configuration:

kubectl get replicationslice -n kubeslice-<projectname>

Example

kubectl get replicationslice -n kubeslice-avesha

Example Output

NAME       AGE
boutique 10s

Use the following command to validate the source and destination worker clusters connected to the replication slice:

kubectl get workerreplicationslice -n kubeslice-<projectname>

Example

kubectl get workerreplicationslice -n kubeslice-avesha

Example Output

NAME          AGE
boutique-w1 10s
boutique-w2 10s

Validate the Replication Slice on the Worker Cluster

Use the following command to verify the replication slice from the source or the destination worker cluster:

kubectl get deploy -n replication

Expected Output

NAME     READY   UP-TO-DATE   AVAILABLE   AGE
velero 1/1 1 1 10s

Replicate Applications

Replicating applications are achieved through replication jobs. A replication job is dedicated to replicating only one namespace. Configure a replication job to replicate a namespace.

A replication job copies resources/data from the source cluster to a repository folder in the controller cluster and restores those resources/data on the destination cluster.

info

Only one namespace can be configured in a replication job.

Create the Replication Job

Create a replication job using the following template.

info

To know more about the configuration details, see slice parameters

apiVersion: controller.kubeslice.io/v1alpha1
kind: ReplicationJobConfig
metadata:
name: boutique-replication
namespace: kubeslice-avesha
spec:
replicationSliceName: boutique-replication
namespace: boutique-replication

Apply the Replication Job

Apply the replication slice configuration on the controller cluster. Use this command to apply the replication slice configuration on the project namespace:

kubectl apply -f <replication job configuration>.yaml -n <project namespace>

Where:

  • <replication job configuration>.yaml is the name of the YAML file that you created for the replication job.
  • <project namespace> is the namespace that you have created a project.

Validate the Replication Job on the Controller Cluster

Use the following command to validate the slice configuration:

kubectl get replicationjobconfig  -n kubeslice-<projectname>

Example

kubectl get replicationjobconfig  -n kubeslice-avesha

Example Output

NAME       AGE
boutique 10s

Use the following command to validate the worker clusters connected to the replication slice:

kubectl get workerreplicationjobconfig  -n kubeslice-<projectname>

Example

kubectl get workerreplicationjobconfig  -n kubeslice-avesha

Example Output

NAME          AGE
boutique-w1 10s
boutique-w2 10s

Validate the Replication Job on the Source Worker Cluster

Use the following command to verify the replication job on the source worker cluster:

kubectl get backup -n replication

Expected Output

NAME                 AGE
kubeslice-boutique 9s

Validate the Replication Job on the Destination Worker Cluster

Use the following commands to verify the replication job on the destination worker cluster:

  1. Backup

    kubectl get backup -n replication

    Expected Output

    NAME                 AGE
    kubeslice-boutique 9s
  2. Restore

    kubectl get restore -n replication

    Expected Output

    NAME                 AGE
    kubeslice-boutique 9s