Disaster Recovery in Cloud Kubernetes
Disaster Recovery in Cloud Kubernetes
net/publication/363632856
CITATION READS
1 822
1 author:
SEE PROFILE
All content following this page was uploaded by Sergio Fernandez Rubio on 17 September 2022.
School of Computing
April 2022
1
MSc dissertation check list
Has your supervisor seen a full draft of the dissertation before submission? Yes
Has your supervisor said that you are ready to submit the dissertation? Yes
1
Please note the page numbers where evidence of meeting the learning outcome can be found in your
dissertation.
2
Authorship Declaration
I, Sergio Fernández Rubio, confirm that this dissertation and the work presented in
it are my own achievement.
Where I have consulted the published work of others this is always clearly
attributed;
Where I have quoted from the work of others the source is always given. With the
exception of such quotations this dissertation is entirely my own work;
I have read and understand the penalties associated with Academic Misconduct.
I also confirm that I have obtained informed consent from all people I have
involved in the work in this dissertation following the School's ethical guidelines
Signed:
Date: 25/01/2022
3
Data Protection Declaration
Under the 1998 Data Protection Act, The University cannot disclose your grade to
an unauthorised person. However, other students benefit from studying
dissertations that have their grades attached.
Please write your name below one of the options below to state your preference.
The University may make this dissertation, with indicative grade, available to
others.
The University may make this dissertation available to others, but the grade may
not be disclosed.
4
Abstract
5
Contents
1 INTRODUCTION .................................................................................... 11
1.1 Background ................................................................................................................................. 12
2 LITERATURE REVIEW.......................................................................... 16
2.1 The Nature of Disaster Recovery & SLAs ................................................................................ 16
4 IMPLEMENTATION ............................................................................... 32
4.1 Software stack ............................................................................................................................. 32
4.1.1 Velero .................................................................................................................................. 32
4.1.2 Bash ..................................................................................................................................... 33
4.1.3 Terraform ............................................................................................................................ 35
4.1.4 Helmfile / Helm ................................................................................................................... 36
4.1.5 Kustomize: Test Application ............................................................................................... 40
4.1.6 Additional Kubernetes utilities ............................................................................................ 43
4.1.7 Git / GitHub......................................................................................................................... 43
4.1.8 R language........................................................................................................................... 43
6
5 EXPERIMENTS ...................................................................................... 48
5.1 Experimentation ......................................................................................................................... 48
5.1.1 Implementation of experiments ........................................................................................... 50
5.1.2 Experiment run .................................................................................................................... 52
6 EVALUATION ........................................................................................ 54
6.1 Results .......................................................................................................................................... 54
7 CONCLUSIONS ..................................................................................... 65
7.1 Research Overview ..................................................................................................................... 65
8 REFERENCES ....................................................................................... 69
Project proposal.................................................................................................................................... 74
7
List of Tables
8
List of Figures
9
Acknowledgements
I would like to give special thanks to my supervisor, Dr. Paul Lapok, for its great
amount of help and patience, even when it took much time selecting the right
topic for this project. I am also grateful to Dr. Neil Urquhart for its suggestions
and insightful questions.
I would also like to give special thanks to my manager at my current job position,
Mr. Fabian Dörk, for its continuous support and for the agreeing of the use of
resources by Claranet Deutschland GmbH. I am also grateful to Mr. Aitor
Zabala, my former manager, who supported and encouraged me by sending
the needed recommendation letter to start this MSc.
I would also like to give special thanks to Ms. Raquel Teruel, who kindly
proofread this document in a timely manner. I am also very grateful to my
mother, Ms. María Dolores Rubio, who supported me financially to successfully
conclude this MSc.
Thanks also go to my wonderful wife Annais for her support during all these
difficult times, enduring with me throughout time along with my health problems.
Without her kind help and understanding, this project would have never come
to fulfilment.
10
1 Introduction
11
2. Pilot Light.
3. Warm Standby.
4. Multi-site active/active.
Two main disaster types (system upgrades, power issues) were mapped to the
Backup & Restore architecture, which was studied through tests in the different
cloud providers. Both disasters are the main drivers of disaster in businesses
worldwide (Alhazmi & Malaiya, 2013).
1.1 Background
Interest in disaster recovery has been an increasingly researched topic in
general. Although there is no single definition of disaster recovery (Marshall &
Schrank, 2013), Quarantelli defines it broadly as “reconstruction, restoration,
and rehabilitation, bringing the post disaster situation to some level of
acceptability” (Quarantelli, 1999). Although this is a term commonly used when
discussing in the context of Information Technology (IT) systems, as a matter
of fact, disaster recovery can refer to any non-IT area susceptible to disaster,
and susceptible to a recovery.
12
Disaster recovery measures typically include the following four key steps to its
adoption (Rudolph, 1990):
There are other examples as well in cloud environments in more recent years
about DR. Sahi et al. studied cloud DR practices for the eHealth sector oriented
to RPO (Sahi et al., 2016), where approaches to harden the security and
privacy of the data were suggested. Another example is Tamimi et al. which
researches in a theoretic way about the topic of DR in the cloud (Tamimi et al.,
2019), and as a result informational tables were developed with details per
service on RPO and RTO.
But there are relatively few exploring disaster recovery in Kubernetes, and even
then, just explanatory (Minh Bui, 2020), and, as far as known, none about
disaster recovery on managed Kubernetes clusters in the cloud.
13
Therefore, in this project, the concept of disaster recovery within the context of
Kubernetes is explored, and more specifically, within the cloud as a managed
service. This approach is one of the main three patterns of Kubernetes
deployment models (Chandrasekaran, 2020a).
The disasters addressed in this work are defined in this section. This is a key
aspect, as everything to be designed will be based on the type of disaster to be
faced and this must be explicitly written on the DRP (Disaster Recovery Plan).
Based on a Symantec study from 2010, the two main causes for disasters in a
5-year period are system upgrades, and power outage/failure/issues (Suguna
& Suhasini, 2015).
System (or software) upgrades are the leading cause of disaster. This means,
routinely planned upgrades by clients on systems can leave the system
inoperable, with the impossibility of running a given application. This does not
mean the cloud services are unavailable, as it is understood that they are still
available.
14
The research questions that this project will address are:
The aim of this project is to research, explore and evaluate the current disaster
recovery solutions available for Kubernetes running in the cloud, as a managed
service, comparing and evaluating the offering in the different cloud providers.
To achieve the aims of this project, this dissertation is set out as follows:
• In chapter 3, the methodology for this work is set. The scope of the tests
is explained and delimited, the foundations for the benchmarking are
set, the applications under test will be shown, as well as the underlying
software needed for the tests.
15
2 Literature review
The following metrics or KPIs are key to defining the Disaster Recovery
efficiency (Suguna & Suhasini, 2015):
These definitions define SLAs and SLOs for the workloads running in a given
cluster.
16
In managed Kubernetes distributions in the cloud, SLAs are publicly available
(Google Kubernetes Engine SLA | Google Cloud, 2021)(Amazon EKS Service
Level Agreement, 2020), and therefore, the target SLAs should be calculated
for a given workload based on these figures. Therefore, the RTO and RPO
should be designed according to these.
Disasters also come in various forms. Alhazmi and Malaiya (2013) mentioned
the most likely causes of a disaster in a 5-year period including system
upgrades, power outage/failure/issues, fire, configuration change
management, cyber-attacks… Hence, the focus will remain on the first two
causes (system upgrades and power issues) when comparing the offerings in
Google GKE and Amazon EKS.
It is also critical for businesses to assess the total costs before considering an
approach to disaster recovery. Usually, over a year, the total cost could be
calculated as following (Alhazmi & Malaiya, 2012):
𝐶𝑇 = 𝐶𝑖 + 𝐶𝑜 + 𝐶𝑑
17
Where 𝐶𝑇 is the sum of the initial cost 𝐶𝑖 , recurring cost 𝐶𝑜 , plus the expected
annual cost of potential disasters 𝐶𝑑 .
Similarly, the ongoing (or recurring) cost 𝐶𝑜 is the sum of ongoing storage cost
𝐶𝑜𝑠 , data transfer cost 𝐶𝑜𝑡 , and processing cost 𝐶𝑜𝑝 .
The annual disaster cost is defined as the total expected cost of disaster
recoveries 𝐶𝑟𝑖 plus the unrecoverable disasters 𝐶𝑢𝑖 , for each type of disaster 𝑖
and its probability 𝑝𝑖 .
𝐶𝑑 = ∑ 𝑝𝑖 (𝐶𝑟𝑖 + 𝐶𝑢𝑖 )
𝑖
It should be noted that the recovery cost includes the cost of using the backup
after the failover and the cost of lost transactions. The cost of lost transactions
is proportional to the RTO duration. Loss of reputation would be another factor
to consider.
18
- Onsite (Backup and running system in one location): Data can be
synchronized easily, high risk of a dual disaster, high initial costs and
high post-disaster costs.
- Cloud (Backup located in one of the available cloud vendors): Data can
be synchronized less, depending heavily on traffic costs. Low risk of dual
disaster, low initial costs, low post-disaster costs.
There are many mechanisms available for disaster recovery, each one with its
own particularities, which could be mainly summarised in three main
mechanisms (Suguna & Suhasini, 2015; Wood et al., 2010) which are:
19
site is not readily available to act swiftly when a disaster occurs, as
hardware may be needed to be swapped, and operating systems and
applications to be installed. This is the only adequate option for
applications that do not need strict SLAs.
Velero mainly is a tool for backing up cluster resource data. Still, Velero is not
only concerned with the management of Kubernetes resource data but also
serves as a framework for managing application data. Starting from Velero 1.5,
it also supports Restic, a backup tool which now works with Kubernetes
volumes (Amarnath, 2020). Usually, and before the implementation of Restic,
volumes would be backed up through the tools made available by means of the
cloud vendors, which provide the underlying storage driver.
Nevertheless, Velero is currently the only open-source tool actively used for
disaster recovery in Kubernetes, therefore, it is going to be employed for the
analysis and tests.
1. The Velero CLI makes a call to the Kubernetes API server to create a
backup CRD object.
2. The backup controller:
a. Checks the scope of the backup CRD object, namely if filters are
set.
b. Queries the API server for the resources that need a backup.
21
c. Compresses the retrieved Kubernetes objects into a .tar file and
saves it in Amazon S3.
1. The Velero CLI makes a call to Kubernetes API server to create a restore
CRD that will restore from an existing backup.
2. The restore controller:
a. Validates the restore CRD object.
b. Makes a call to Amazon S3 to retrieve backup files.
c. Initiates restore operation.
22
Velero needs to use the plugins for the snapshots of the volumes, depending
on the cloud provider in which is being installed.
2.6 Summary
This chapter gave an overview of what Disaster Recovery is. Different types of
approaches to disaster recovery in the literature and in practice were numbered
and described; its pros and cons were also discussed. Metrics for the correct
definition of a DR were given and explained, such as RTO and RPO. Moreover,
they were linked to business SLAs, which are of utmost importance for the
success of businesses in a 5-year period. Additionally, costs were considered,
showing practical equations to calculate the impact on costs having DR into
account. Finally, DR was discussed in the context of Kubernetes, and Velero
was presented.
Reflecting on the main questions and aims of this project, it has been found that
RTO and RPO can be decreased on practice in virtual machine-based
workloads, using different DR approaches, such as cold, warm, or hot standby
sites. However, Kubernetes workloads have not been tested this way in the
literature. Therefore, in this work RTO and RPO will be studied in Kubernetes
in different scenarios, and the limits and consequences of each solution will be
considered. Neither differences in DR approaches in cloud providers has been
studied in the literature, and this project will address it, both in AWS and GCP.
23
3 Design & Methodology
This chapter shows the methodology used in this project, to examine and
benchmark the different approaches to DR in Kubernetes.
3.1 Scenarios
As mentioned in Chapter 1, the focus of this project will be targeting mainly two
types of disasters: System/software upgrade failures, and power outage / failure
/ issues.
The approach will be different in both cases, as the situation implies and needs
a different kind of recovery technique, and in both cases the possible concepts
are going to be explored. However, both scenarios will leverage a common
software stack.
Both scenarios will leverage Velero, which will oversee the resource backup,
as well as the volume backup, where the data is held. Velero offers the
possibility to use the storage driver provided by the cloud vendor to make the
snapshots, through means of plugins, as explained in the earlier chapter.
24
install and upgrade apps. In this case, Helmfile is a wrapper of helm, improving
it in specific ways, and making the deployment easier. This way, we can deploy
Velero each time seamlessly.
The application subject to the tests is depicted in Figure 3. This testing scenario
is composed of a simple WordPress blog, which uses MySQL as a database.
Both the application and data recovery are going to be tested, simulating the
state after a disaster.
25
The resulting Kubernetes stack is shown in Figure 4. Velero will need to be
installed on a different namespace, and another namespace should be created
to hold all the application testing environment, which will use deployments,
services, and persistent volumes.
26
that, although a regional cluster would improve the SLA metric, the focus will
be on the steps after the disaster, thus not affecting total RTO and RPO in our
case, Additionally, power issues (the second disaster scenario) could affect
entire regions too, so regardless of the option, it could be argued that the
second scenario would not affect the outcomes in terms of RTO and RPO.
The aim, similarly, will be to measure and compare both cloud providers
through a series of tests, for both scenarios. Cloud vendors provide shared
resources, so differences based on the total usage during the test time should
be expected. There are references on AWS (Bakshi & Kim, 2021; Miller &
Ciuffo, 2021) and on GCP (Disaster Recovery Planning Guide | Cloud
Architecture Center | Google Cloud, n.d.) about approaches and
recommendations in Disaster Recovery.
27
In figure 5, the first scenario and the approach is showcased to the
measurement of time. The detection and triggering of the alert of the disaster
will not be part of this study, as access to live clusters for this project is not
possible. Software like Prometheus or Nagios can be configured to alert about
the disasters, and act automatically or manually, depending on previous
decisions on SLA constraints.
The time measurement loop will start right before the deletion of the errored
resources. As explained earlier, the disaster is a software upgrade malfunction,
and the first step for disaster recovery remediation is to delete the resources
already in the cluster, as having duplicated resources in the same cluster can
create unintended havoc.
28
Figure 6 - Time measurement for scenario 2
The rationale behind this decision, is that after a power issue at the zone/region,
the cluster would be inaccessible. For the tests, the resources will be destroyed,
as well as the cluster to simulate the disaster. But this time will not count
towards the benchmark, as it is an artificial step.
29
Therefore, the first step after a disaster is to create the cluster at another
location. This step could be fully automated, but the software should be aware
of the location of the incidents, and this could be difficult to guess after a
disaster, because the software should be aware of the areas that have not been
affected. Otherwise, this step needs to be manual.
Then, after the creation of the cluster, and depending on the cloud provider, the
initial configuration for the cluster needs to be applied. This could be, for
example, the configuration of a storage provider, monitoring, or logging.
Applications usually depend on other pieces of software in a ready state.
Following with the next step, is the installation of Velero. In order to issue a
Velero restore process, Velero needs to be installed in the cluster. Then, after
all these steps, the same steps as on the first scenario will be performed: The
restore operation is issued, and the completion of it will be waited.
Where 𝑛0 is the sample size, 𝑍 2 is the abscissa of the normal curve that cuts
off an area α at the tails (1 - α equals the desired confidence level, e.g., 95%),
e is the desired level of precision, p is the estimated proportion of an attribute
that is present in the population, and q is 1-p. The value for Z is found in
statistical tables which contain the area under the normal curve.
Due to the fact that the population is infinite in our scenarios, the formula can
be successfully applied. Assuming a maximum variability 𝑝 = 0.5 (as we do not
know the characteristics of the population), and for a 95% confidence interval
with ± 5% precision, the resulting sample size is the following:
30
Which results in 385 samples, as it is always recommended to round up when
calculating sample sizes. Unfortunately, this number of tests is higher than our
allowed budget, as cloud costs are expensive. Therefore, the tests to be run on
scenario 1 will be 50 for each environment. For scenario 2, the number will be
20 samples, because it is more expensive to run.
3.4 Summary
In this chapter the methodology for the deployment of the test environment, as
well as the design of the benchmarks have been discussed. Kubernetes
environments in both clouds and both scenarios have also been explained, as
well as the deployment tools, such as Velero, Terraform, Helmfile, Kustomize
and Bash, which will serve us as the fundamental DR stack.
The number of tests has also been calculated in this chapter, as there was no
other study involving RPO, RTO and Kubernetes. However, the resulting
number has resulted extremely high, and our budget is out of scope for that
number.
31
4 Implementation
After implementation tools and scenarios were studied, the need of a fully
automated disaster recovery process is paramount, so all the implementation
has considered this requirement.
In this section, the software to be used during the tests is going to be presented
and described. Only the key/main pieces of software are explained, as the
complete software stack that has been used cannot fit under this section. This
includes the Disaster Recovery software, the programming languages used,
and related Kubernetes tooling. It is worth noting, that some of the used
software code is partially inspired and taken from the internal Claranet GmbH
repositories.
4.1.1 Velero
Velero is, as already mentioned, the key basic open-source tool for disaster
recovery in Kubernetes. It restores the cluster resources as well as the
persistent volumes. Velero can be used for more use cases, like for migrations
and replications of production clusters, but this project will focus on the DR use
case.
Our scenario for disaster recovery will use its backup and restore services. An
example restore operation is shown on Figure 7, which exemplifies the restore
process in our experiments, which will be used many times for the tests, as
opposed to the backup service, which will only be needed once.
32
Figure 7 - Velero recovery process in the scenarios
4.1.2 Bash
Since Ubuntu is being used for our development, and the rest of the tools mainly
offer Command Line Interface (CLI) tools, it was decided to use this approach.
In this context, loops are programmed to replicate the tests for a definite number
of times, and a system to execute commands after a successful restore has
been designed.
On Figure 8, the main file can be seen for scenario 1. This file destroys the
workload objects suffering the simulated DR and reapplies it from a previous
backup.
33
#!/bin/bash
kubectl delete -k ./
until velero restore create $RANDOM-my-backup-$RANDOM --from-backup
test;
do
sleep 1;
done;
until kubectl -n workload wait deploy/wordpress --timeout=300s --
for=condition=available;
do
sleep 1;
done;
On Figure 9, the control loop is shown. This bash file calls recursively the
previous file, timing the full run.
#!/bin/bash
TIMEFORMAT=%R;
for i in {1..50}
do
sleep 5
time timeout 300s ./[Link]
sleep 5
done
On Figure 10, the main file can be seen for scenario 2. This file applies the
Terraform files, and then Velero is installed in the cluster, and the backup is
restored.
34
#!/bin/bash
terraform -chdir=terraform/cluster/ apply -auto-approve
gcloud container clusters get-credentials sergio-test --zone europe-
west1-b --project claranet-playground # FOR GKE
aws eks --region eu-west-3 update-kubeconfig --name sergio-test # FOR
EKS
helmfile -f kubernetes/velero/[Link] apply
until velero restore create my-backup --from-backup test
do
sleep 1;
done;
until kubectl -n workload wait deploy/wordpress --timeout=300s --
for=condition=available;
do
sleep 1;
done;
On Figure 11, the control loop is shown. This bash file calls recursively the
previous file, timing the full run. The first lines are not including in the time
tracking, as this are steps done in order to delete the cluster, which is not in
scope for this project.
#!/bin/bash
TIMEFORMAT=%R;
for i in {1..20}
do
kubectl delete svc -n workload wordpress
terraform -chdir=terraform/cluster/ destroy -auto-approve
kubectl config unset <cluster-name>
sleep 5
timeout 2000s time ./[Link]
sleep 5
done
4.1.3 Terraform
To interact with the cloud provider, Terraform files have been developed. The
state has been saved locally, as the work is undergoing in just one computer.
They mainly consist of a storage bucket, a Kubernetes cluster, and its network-
related configuration, in addition to policies to access the cluster and the
storage bucket.
35
In Amazon, the storage bucket service is called “S3”, and in GCP it is called
“Cloud Storage”. Terraform version 1.1.6 will be used. The files are shown and
explained in Appendix 2, since they occupy many pages.
context: gke_claranet-playground_europe-west1-b_sergio-test
repositories:
- name: vmware-tanzu
url: [Link]
releases:
- name: velero
namespace: velero
chart: vmware-tanzu/velero
version: 2.27.1
labels:
group: backup
app: velero
release: velero
values:
- [Link]
set:
- name: [Link]
file: ../../secrets/terraform/service-accounts/velero-
backups@[Link]
On Figure 12, the main Helmfile file is shown. VMware provides the chart of
Velero, so it is used as our chart repository. Then, the Velero deployment is
defined, using the Velero chart version 2.27.1. Credentials are finally needed in
order to grant Velero “write” access to the Google Cloud Storage bucket.
36
image:
repository: velero/velero
tag: v1.7.1
pullPolicy: IfNotPresent
initContainers:
- name: velero-plugin-for-gcp
image: velero/velero-plugin-for-gcp:v1.3.0
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /target
name: plugins
metrics:
enabled: false
kubectl:
image:
repository: [Link]/bitnami/kubectl
configuration:
provider: gcp
backupStorageLocation:
name: gcp
bucket: "velero-backups-sergio-test"
credentials:
useSecret: true
upgradeCRDs: true
backupsEnabled: true
snapshotsEnabled: true
deployRestic: false
On Figure 13, the values file can be found, which configures details for the
Velero deployment. First of all, Velero version 1.7.1 is going to be employed.
Then the Velero plugin for Google Cloud Platform is set. Next, metrics are
disabled, otherwise the deployment fails as there is no Prometheus server
running in the cluster. Afterwards, the bucket name is specified, and backup
and snapshots are enabled.
37
context: arn:aws:eks:eu-west-3:384894877891:cluster/sergio-test
repositories:
- name: vmware-tanzu
url: [Link]
releases:
- name: velero
namespace: velero
chart: vmware-tanzu/velero
version: 2.27.1
labels:
group: backup
app: velero
release: velero
values:
- [Link]
On Figure 14, the Helmfile is shown. It is really similar to the GCP one, but it
lacks the secret configuration in the end. This is due to AWS incorporating an
OpenID Connect (OIDC) Identity Provider, in which a trust relationship can be
established between a Velero Service Account and the S3 bucket to be
configured.
38
image:
repository: velero/velero
tag: v1.7.1
pullPolicy: IfNotPresent
initContainers:
- name: velero-plugin-for-aws
image: velero/velero-plugin-for-aws:v1.3.0
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /target
name: plugins
podSecurityContext:
fsGroup: 1337
metrics:
enabled: false
kubectl:
image:
repository: [Link]/bitnami/kubectl
configuration:
provider: aws
backupStorageLocation:
name: aws
bucket: "sergio-tests-velero-backups"
config:
region: eu-west-3
serviceAccount:
server:
create: true
name: velero
annotations:
[Link]/role-arn:
"arn:aws:iam::384894877891:role/velero-role"
credentials:
useSecret: true
backupsEnabled: true
snapshotsEnabled: true
upgradeCRDs: true
deployRestic: false
On Figure 15, the values file can be seen, showing many similarities to the
GCP one, but being more verbose due to the OIDC provider being configured.
It includes a service account, which is created with the assigned role to
communicate with the S3 bucket.
39
4.1.5 Kustomize: Test Application
To deploy the workload, Kustomize is used, which will ease the deployment
and repeatability. In this case, the password is introduced in a shared space, to
be distributed by both the WordPress client and the MySQL database, as
shown in Figure 16. This example has been partially extracted from the official
sample guide available from the Kubernetes webpage (Example: Deploying
WordPress and MySQL with Persistent Volumes | Kubernetes, n.d.)
secretGenerator:
- name: mysql-pass
namespace: workload
literals:
- password=testing123
resources:
- [Link]
- [Link]
On Figure 18, the MySQL deployment is shown. After defining the Kubernetes
namespace in which the application will run, again a similar Service object is
defined to expose MySQL for the WordPress deployment in port 3306.
Likewise, there is a PersistentVolumeClaim configured, as well as a MySQL
deployment with version 5.6 deployed.
40
apiVersion: v1
kind: Service
metadata:
namespace: workload
name: wordpress
labels:
app: wordpress
spec:
ports:
- port: 80
selector:
app: wordpress
tier: frontend
type: LoadBalancer
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: workload
name: wp-pv-claim
labels:
app: wordpress
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: workload
name: wordpress
labels:
app: wordpress
spec:
selector:
matchLabels:
app: wordpress
tier: frontend
strategy:
type: Recreate
template:
metadata:
labels:
app: wordpress
tier: frontend
spec:
containers:
- image: wordpress:4.8-apache
name: wordpress
env:
- name: WORDPRESS_DB_HOST
value: wordpress-mysql
- name: WORDPRESS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password
ports:
- containerPort: 80
name: wordpress
volumeMounts:
- name: wordpress-persistent-storage
mountPath: /var/www/html
volumes:
- name: wordpress-persistent-storage
persistentVolumeClaim:
claimName: wp-pv-claim
41
apiVersion: v1
kind: Namespace
metadata:
name: workload
---
apiVersion: v1
kind: Service
metadata:
namespace: workload
name: wordpress-mysql
labels:
app: wordpress
spec:
ports:
- port: 3306
selector:
app: wordpress
tier: mysql
clusterIP: None
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: workload
name: mysql-pv-claim
labels:
app: wordpress
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: workload
name: wordpress-mysql
labels:
app: wordpress
spec:
selector:
matchLabels:
app: wordpress
tier: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: wordpress
tier: mysql
spec:
containers:
- image: mysql:5.6
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
42
4.1.6 Additional Kubernetes utilities
To test, modify and work with the Kubernetes environment, there exist auxiliary
tools which help to debug the deployments and troubleshoot issues.
The first tool to be mentioned is a tool to access the UI from the local
environment, called kubefwd (Kubefwd - Kubernetes Service Forwarding, n.d.).
Kubefwd is going to be employed several times during testing, to simplify the
access and test the Persistent Volumes are correctly downloaded.
A second tool which will aid in our case is kubectx (GitHub - Ahmetb/Kubectx:
Faster Way to Switch between Clusters and Namespaces in Kubectl, n.d.). This
tool will assist in the process of switching between clusters by modifying the
local kubeconfig file. This utility also comes with the kubens command, which
allows the switching of Kubernetes namespaces, as well by modifying the local
kubeconfig file.
The distributed version control system Git has been used to track the files of
this project, as a backup system with GitHub, and as a way to transfer data
from the different workstations where this project has been realised.
4.1.8 R language
On Figure 19, data is loaded from the timings data per environment and per
scenario. Then, they are plotted for reference but without saving the output.
Then, the data is extracted into a xlsx file, which is needed to be imported in
this dissertation.
43
Then, the data is combined and plotted three times, using density plots. This
time, the charts will be saved, to import then into this dissertation.
44
library("stringr"); library("ggplot2"); library("dplyr"); library("writexl")
# Workload
aws_workload$group <- "aws"
gcp_workload$group <- "gcp"
workload_combine <- rbind(aws_workload, gcp_workload)
workload <- ggplot(workload_combined, aes(x=time_elapsed, fill=group)) +
geom_density(alpha=.5) +
ggtitle("Time elapsed for recovery in scenario 1") + labs(fill = "Vendor", x="Time elapsed
(s)", y="Density")
ggsave("[Link]", plot=workload)
45
gcp_cluster <- [Link]("../gke/[Link]", header = F, sep = " ", colClasses =
"numeric")
colnames(gcp_cluster) <- "time_elapsed"
[Link](gcp_cluster$time_elapsed, aws_cluster$time_elapsed)
[Link](gcp_cluster$time_elapsed, aws_cluster$time_elapsed-aws_cluster$time_elapsed_oidc)
[Link](gcp_workload$time_elapsed, aws_workload$time_elapsed)
4.2.1 AWS
The Kubernetes version is going to be 1.21, and Spot instances will be used to
reduce the cost of the continuous deployments. 20GB of disk storage will be
requested for each worker node. An OIDC Identity Provider will also be
requested to allow services to authenticate themselves to other AWS services.
Region “eu-west-3” (Paris) will be used for the tests, as it is the closest option
to where the test workstation is placed. The S3 bucket will be as well placed in
the same region.
46
In order to download the kubeconfig file locally (to access the cluster from local)
the command-line utility “aws” is going to be employed. This utility is able to
perform many common and uncommon tasks in AWS.
4.2.2 GCP
On GCP, the GKE service is offered as a cloud-managed Kubernetes cluster.
The to-be deployed cluster will be allocated in a single zone, with a single
master node, with the instance type set to “n2-standard-2”, which provides two
2rd/3rd generation Intel Xeon Scalable CPUs (Depending on availability and
location) and 8GBs of memory.
4.3 Summary
In summary, there is a wide variety of software being used to perform the tests,
a complex stack which uses complex pieces of software.
Velero is going to perform the actual backups and restores, Terraform interacts
and commands cloud resources, Helm installs software in the cluster,
Kustomize will install the test application in the cluster too, and Bash will be
used to glue everything together. R language is utilised for plotting the charts,
and both clouds (AWS, GCP) are going to be similarly used as our resource
provider.
47
5 Experiments
In this chapter, the results of the experiments are described. They have been
conducted following the study and design presented in previous chapters,
employing the software mentioned in the last one.
5.1 Experimentation
In this section, the experiments are described as initially planned. To run the
experiments, some preliminary work was needed to be performed, as the
written software is expecting a fully set up cluster with backups and an
application successfully configured. Therefore, firstly the preparation steps are
explained, regardless of the cloud provider being put to test.
48
.
├── eks
│ ├── kubernetes
│ │ ├── velero
│ │ │ ├── [Link]
│ │ │ └── [Link]
│ │ └── workload
│ │ ├── [Link]
│ │ ├── [Link]
│ │ ├── [Link]
│ │ ├── password
│ │ ├── [Link]
│ │ └── [Link]
│ ├── [Link]
│ ├── terraform
│ │ ├── eks-cluster
│ │ │ ├── [Link]
│ │ │ ├── [Link]
│ │ │ ├── [Link]
│ │ │ ├── [Link]
│ │ │ ├── [Link]
│ │ │ ├── [Link]
│ │ │ └── [Link]
│ │ └── platform-services
│ │ ├── [Link]
│ │ ├── GENERAL_var.tf
│ │ ├── [Link]
│ │ └── [Link]
│ ├── [Link]
│ └── [Link]
├── gke
│ ├── kubernetes
│ │ ├── velero
│ │ │ ├── [Link]
│ │ │ ├── [Link]
│ │ │ ├── [Link]
│ │ │ ├── [Link]
│ │ │ └── [Link]
│ │ └── workload
│ │ ├── [Link]
│ │ ├── [Link]
│ │ ├── [Link]
│ │ ├── password
│ │ ├── [Link]
│ │ └── [Link]
│ ├── [Link]
│ ├── secrets
│ │ └── velero-backups@[Link]
│ ├── terraform
│ │ ├── gke-cluster
│ │ │ ├── [Link]
│ │ │ ├── [Link]
│ │ │ ├── [Link]
│ │ │ └── [Link]
│ │ └── platform-services
│ │ ├── [Link]
│ │ ├── [Link]
│ │ ├── [Link]
│ │ └── [Link]
│ ├── [Link]
│ └── [Link]
├── R
│ ├── aws_cluster.xlsx
│ ├── aws_workload.xlsx
│ ├── charts.R
│ ├── [Link]
│ ├── gcp_cluster.xlsx
│ ├── gcp_workload.xlsx
│ ├── sample_size.R
│ ├── t-test.R
└── [Link]
49
5.1.1 Implementation of experiments
After the cluster is up and running, the kubeconfig files need to be set that one
may interact with the Kubernetes cluster. The commands to fetch the
kubeconfig files are the following:
50
gcloud container clusters get-credentials sergio-test --zone europe-
west1-b --project claranet-playground
When the clusters are added locally, the application is next deployed through
Kustomize.
Then, using kubefwd utility, a proxy is created for the Service object (The same
command is used in both environments).
Therefore, the local workstation can access the WordPress UI and configure a
test blog, as seen in Figure 23.
51
Then, Velero must be installed to back up the running workload. The installation
is done through Helmfile with the following command:
schedules:
my-schedule:
schedule: "30 1 1 1 *"
template:
storageLocation: <storage-location> # ”gcp” or “aws”
ttl: "9999h0m0s"
includedNamespaces:
- workload
includedResources:
- '*'
Figure 24 - Part of the Helmfile values file which was added later to schedule the backup
Finally, when connected to the cluster, the schedule was triggered with the
following command:
Lastly, the clusters are teared down. However, this instruction is already
included in the [Link] file, which will be in charge of running the tests.
To undertake the tests for the first scenario (Software / system upgrades
disaster), a simple command is needed, as follows:
52
./gke/kuberentes/workload/[Link]
./eks/Kubernetes/workload/[Link]
This will make the test run 50 times for each environment. The test time is
relatively short, being less than 1h30min long for both environments,
approximately. However, this has taken longer in Google because there were
some random errors for unknown reasons while restoring the backup.
On the other hand, the tests for the second scenario (Area outage, by any
means, like power outages) are the following:
./gke/[Link]
./eks/[Link]
The tests have been run 20 times in each environment. The test time is long,
especially in AWS, where it has taken more than 30 hrs. in total, approximately.
In GCP the time has been considerably less, amounting to less than 7 hrs.,
approximately. The tests have been run at different times of the day and in
different days, until the target number of samples have been gathered.
For AWS, the test included the collection of two timings: Total time and the time
spent configuring the OIDC Identity Provider. The configuration of this service
is very time-consuming. However, this is the recommended way of accessing
AWS-managed services like S3. This metric was collected to be later
subtracted it from the total time, with the aim of having a fairer comparison
between the two cloud providers.
5.2 Summary
In this chapter, the preparation of the experiments and the test runs were
carried out, both in AWS and GCP. This paved the way to analyse the results
in the next chapter.
53
6 Evaluation
In this chapter, and having completed the experiments, it is time to evaluate the
work being carried out and extracting the value from it. In this chapter, a critical
evaluation of the strengths and limitations will be accomplished.
6.1 Results
Table 1 - Timings for Scenario 1 in GCP Table 2 - Timings for Scenario 1 in AWS
54
Beginning with the first scenario, where 50 tests were arranged and executed,
the results have been the following, being Table 1 for GCP and Table 2 for AWS
In order to understand the data, a chart has been developed with R (Figure 25).
This draws a kernel density estimate, which is a smoothed version of the
histogram (Geom_density Function - RDocumentation, n.d.).
After executing the t-test, the conclusion is that the p-value of the tests is less
than the significance level 𝑎𝑙𝑝ℎ𝑎 = 0.05 (actually, 𝑝 = 4.908 ∗ 10−14).
Consequently, the conclusion is that the GCP timings average is significantly
different from AWS. Thus, EKS is considerably faster when recovering from a
failed software or a failed system, with the following means:
55
34.04768
Now addressing the second scenario, where 20 tests were arranged and
executed, the results are found below, being Table 3 for GCP and Table 4 for
AWS:
Table 3 - Timings for Scenario 2 in GCP Table 4 - Timings for Scenario 2 in AWS
In order to understand the data, another two charts have been developed with
R, which also will draw a kernel density estimate. This time, the second chart
will have the OIDC Identity Provider timing removed, to compare the providers
in a different setting. Both are represented in Figure 26 and Figure 27.
56
Figure 26 - Density plot for Scenario 2
After executing the t-test, for both settings (with and without the OIDC Identity
Provider) the conclusions are as shown:
57
The p-value for the first assumption is clearly below the significance level
𝑎𝑙𝑝ℎ𝑎 = 0.05 (actually, 𝑝 = 2.2 ∗ 10−16 ). Consequently, the first conclusion is
that the GCP timings average is significantly different from AWS. Thus, EKS is
excessively slower when recovering from an area-cluster disaster, with the
ensuing means:
However, this value is biased due to the fact that AWS employs the OIDC
identity provider, which is not available in GCP. If this time is discounted, the p-
value for the second assumption is remarkably below the significance level
𝑎𝑙𝑝ℎ𝑎 = 0.05 (actually, 𝑝 = 0.03). Consequently, the first conclusion is that the
GCP timings average is different from AWS. Thus, EKS is slightly slower when
recovering from an area-cluster disaster without OIDC provider in place, with
the following means:
58
Therefore, the disaster recovery scenario in the GKE cluster, even when
subtracting AWS OIDC, is 39.48295 seconds faster in mean than the EKS
cluster recovery.
Strengths
i. One strength of this project is that the studied scenarios are practical,
and they can cover a wide range of disasters, not only those which were
studied in this context. The results from the 2010 Symantec study
(Symantec 2010 Disaster Recovery Study, 2010) about incidence on
disasters are arguably still valid today, and companies are still facing
several types of disasters.
ii. Also, all the software used for the testing is being actively used in a wide
variety of companies and industries. Sharing this knowledge and
employing it to perform individual tests in the research, development,
and innovation activities of these companies is beneficial for all the
community.
iii. Another strength is the number of tests achieved. Usually, the cloud
provider costs hamper the testing and prevents the research to come to
fruition. This research is only commonly available at the same cloud
companies for internal Key Performance Indicators (KPIs), and this effort
has been made to make public the efficiencies, to guide a prospect client
when deciding provider and calculating its risks.
Limitations
59
i. This research is limited to the studied disasters, as well as some
technical parts of it, for instance, leaving out alerting, or the simulation
of a disaster through chaos engineering. Furthermore, the topic should
be a cross-departmental, joint effort in a business context (Kirvan, 2022).
iii. Study of all Disaster Recovery methods. In GCP and especially in AWS,
there is much advice on how to perform disaster recovery based on
budget. In this project, the focus has been on low-budget scenarios.
Scenarios in which the cluster is recovered in a couple of seconds have
not been studied. Additionally, a specific managed service for Disaster
Recovery for GKE has not been included in the analysis (Backup for
GKE | Google Cloud, n.d.)
iv. There are many cloud providers which were not tested, especially Azure,
commonly regarded as the third player in cloud providers. This project
focused mainly in AWS and GCP.
v. In connection with the budget and the number of experiments, they have
been cautiously spent, and the number is fine when compared to the
inexistence of these tests on literature. However, the number of
experiments were meant to achieve the results from the sample size
formula.
60
charts, or the failure of a recovery process which was experienced
seldomly.
This project has used in several ways the foundations of the work of Suguna &
Suhasini (2015) concerning disaster occurrence, such as electing the two most
recurring disasters mentioned in their work, and techniques in DR, like the cold-
site backup, and applied it to Kubernetes. In a sense, this project could be
considered as a continuation and as an extension of their work, this time
including Kubernetes and adding a comparison between different cloud
providers —not just via estimates on RTO and RPO— which is the case in their
work in Table 2. Furthermore, these estimates are effectively outdated, and as
seen in the results of this research, now the recovery level achieved in terms of
RTO in this project is arguably the same as the top recovery level set in their
work (being a mirrored data with failover). In this project, nothing has been
mirrored. These fast timings can be achieved thanks to the public cloud
providers.
Wood et al. (2010) approaches the topic from a cost perspective, comparing
the Public Cloud and Colocation in Figures 2 and 3. In our project, cost has not
been studied, but a similar approach has been taken to measure the differences
between AWS and GCP in terms of timings, using two distinct scenarios to
compare the big differences that can emerge from two rather similar scenarios.
Minh Bui (2020) uses Velero to design a Disaster Recovery solution for a
particular company. In this scenario, Kubernetes objects are backed up to
AWS. However, it does not include any backup of Kubernetes volumes. In the
current dissertation, the AWS and GCP plugins for the storage of volumes were
also incorporated to the research, bringing it closer to reality.
61
The research questions were the following:
With reference to the first research question, in this study, the methodology
used for the DR of both scenarios has been similar. The study could have
included a comparation between DR in a cold standby, and a DR of a mirrored
scenario, but as explained earlier on, the costs and the time to complete it have
been a restriction. However, as explained in chapters 1 and 2, there are mainly
three (Suguna & Suhasini, 2015) or perhaps four (Eliot, 2021) approaches to
DR. As per Suguna & Suhasini, namely, hot, warm, and cold standby, and as
per Eliot, Backup & Restore, Pilot Light, Warm Standby and Multi-site-
active/active. The concepts and the terminology are slightly outdated because
they apply to a virtual machine-based scenario rather than a container-based
scenario, yet they help in defining the different service levels that a Kubernetes
cluster could achieve. A basic, first level would be a backup & restore scenario,
which was the case in our study. In higher tiers, a second disaster recovery site
should be provisioned, scaled down or fully scaled, contributing towards RTO,
and near or real-time data transfer, contributing to RPO.
62
valued elements which are not only finite, but difficultly replaceable. Thirdly,
and a repercussion which at first sight could go unnoticed, has to do with data
storage location and protection, privacy, and security (Takabi et al., 2010).
Under this presented research, this does not imply any sort of problem.
However, when using cloud-backed global storage, data could reside in
countries or continents not previously agreed with clients, or not compliant with
local regulations.
Another way of answering to the second question, is to review the limits and
consequences of the precise technology employed in this project. Starting with
Terraform, this supposes that the company is already using Terraform to deploy
its DR. Transitioning from manually created cloud resources could be
challenging depending on the scenario, although Terraform includes a
functionality to import resources. Another limitation is that, as of now, it does
not offer Graphical User Interface (GUI). Other solutions which could serve as
alternatives to Terraform include Pulumi or Cloudify. Following now with Velero,
one of its limitations, is that objects do not get overwritten if they exist already.
Another consequence is that the Velero version, Kubernetes version and Helm
version in the recovery cluster must be the same of the original backup, and
this information may be unknown. This applies as well for the number of nodes,
which should be greater or at least equal as of when creating the backup.
63
Regarding the main output from this study, which is the timings between GKE
and EKS services, it could be argued that there are differences, especially on
a zonal disaster scenario, in which an EKS cluster would take more than triples
the time to recover. Additionally, in the first scenario of a software update issue,
EKS would be slightly faster. Although this information is unlikely to change the
decision on what cloud provider to select, it is a critical piece of information
linked to SLA calculations, and similarly, RPO and RTO.
64
7 Conclusions
There are many Disaster Recovery types nowadays, based on the disaster,
technology used, recovery type, and most important, business needs. As
discussed in Chapters 1 and 2, businesses need to critically assess their risks,
and to design a DRP that suits their needs. Therefore, this project has aimed
to clearly differentiate the performance of DR in the Kubernetes clusters of
distinct cloud providers. Additionally, in this work the different possible disasters
have been evaluated, as well as different DR methods.
The project aimed to track RPO, as this was mentioned in the project proposal.
Unfortunately, after studying RPO in the cloud, the only aspect worth extracting
out of our project is that it depends entirely on the schedule configuration of
Velero. It is true that there are solutions involving mirrored PVs in Kubernetes,
but the cloud providers do not offer such service, instead it would rely on a third-
party software, and this would be out of scope for this project, since RPO cannot
be benchmarked, but set accordingly to predefined times. Nevertheless, the
only found open-source data mirroring solution for Kubernetes is merely on its
inception (Tomlinson, n.d.). Application-based replication is not considered
(Run a Replicated Stateful Application | Kubernetes, n.d.).
65
Overall, the expectations and goals have been met. A thorough review of the
available software and configuration of cloud providers was done prior to the
start of the experimentation and before the writing of this document. The
experiments and benchmarks helped characterize RTO timings in both
scenarios, although there is more avenues which could be investigated in future
research.
The takeaways from this dissertation have been several, since even the whole
strategy and concept to finish this dissertation has been one. Focusing on the
main ideas, these would be the key points:
66
The project has been centred on very concrete scenarios, for unlikely real
workloads, with specific cloud/software configurations. A real-world project,
paired with mirror environments to estimate timings would be a perfect way to
characterise a given scenario for a given company, perfecting the estimates
given in this research project. However, the cost would be particularly high. Not
only as per cloud spendings, but because of engineer man-hours.
Nevertheless, the insights could be priceless.
Testing the velocity of Velero snapshots could be another way of continuing this
research. As explained before, this would not be practical for use at a company,
given the fact that there are other better solutions for replicating data in a rapid
way. However, by doing so, a comparison between velocities in different cloud
providers could shed some light into how capable they are at transferring data
at high throughputs from two different services are.
Another clear avenue would be to continue the path this project has taken and
expand its scope to other clouds or private data centres, especially having into
account the fact that the cloud provider Azure was not included. For it to be
tested inside a same cloud vendor, Velero should contain a plugin for the
storage side. Velero officially supports plugins currently for Alibaba, VMware
67
vSphere, DigitalOcean, HPE Storage, OpenEBS, OpenShift, Portworkx, Storj,
Container Storage Interface (CSI) and OpenStack (Velero Plugins, n.d.).
Lastly, another possibility would be to also test the newly available service
“Backup for GKE”, which would compete against our tests. A characterisation
could be made, as well as a comparison with the tests done in the GKE cluster.
At the present time, nevertheless, there was no similar software available for
EKS.
68
8 References
Al-Kiswany, S., Subhraveti, D., Sarkar, P., & Ripeanu, M. (2011). VMFlock:
Virtual machine co-migration for the cloud. Proceedings of the IEEE
International Symposium on High Performance Distributed Computing,
159–170. [Link]
Alhazmi, O. H., & Malaiya, Y. K. (2012). Assessing disaster recovery
alternatives: On-site, colocation or cloud. Proceedings - 23rd IEEE
International Symposium on Software Reliability Engineering Workshops,
ISSREW 2012, 19–20. [Link]
Alhazmi, O. H., & Malaiya, Y. K. (2013). Evaluating disaster recovery plans
using the cloud. Proceedings - Annual Reliability and Maintainability
Symposium. [Link]
Alvarez-Parmar, R. (2020, December 7). Operating a multi-regional stateless
application using Amazon EKS | Containers.
[Link]
stateless-application-using-amazon-eks/
Amarnath, A. (2020, September 16). Velero 1.5: Auto volume backup with
restic, DeleteItemAction plugins, Restore Hooks, and much more!
[Link]
Amazon EKS Service Level Agreement. (2020).
[Link]
Anand, G., & Kodali, R. (2008). Benchmarking the benchmarking models.
Benchmarking, 15(3), 257–291.
[Link]
Andrade, E., Nogueira, B., Matos, R., Callou, G., & Maciel, P. (2017).
Availability modeling and analysis of a disaster-recovery-as-a-service
solution. Computing, 99(10), 929–954. [Link]
017-0539-8/FIGURES/9
As Quarterly Cloud Spending Jumps to Over $50B, Microsoft Looms Larger in
Amazon’s Rear Mirror | Synergy Research Group. (2022, February 3).
[Link]
to-over-50b-microsoft-looms-larger-in-amazons-rear-mirror
Backup and Restore with Velero | Administration Guide | SUSE CaaS
Platform 4.2.4. (n.d.). Retrieved April 2, 2022, from
[Link]
[Link]
Backup for GKE | Google Cloud. (n.d.). Retrieved March 16, 2022, from
[Link]
gke/concepts/backup-for-gke
Baginda, Y. P., Affandi, A., & Pratomo, I. (2018). Analysis of RTO and RPO of
a service stored on Amazon Web Service (AWS) and Google Cloud
Engine (GCE). Proceedings of 2018 10th International Conference on
Information Technology and Electrical Engineering: Smart Technology for
Better Society, ICITEE 2018, 418–422.
[Link]
Bakshi, D., & Kim, B. (2021, November 12). Disaster Recovery with AWS
Managed Services, Part I: Single Region | AWS Architecture Blog.
[Link]
69
aws-managed-services-part-i-single-region/
Balla, D., Simon, C., & Maliosz, M. (2020). Adaptive scaling of Kubernetes
pods. Proceedings of IEEE/IFIP Network Operations and Management
Symposium 2020: Management in the Age of Softwarization and Artificial
Intelligence, NOMS 2020.
[Link]
Burns, B., Grant, B., Oppenheimer, D., Brewer, E., & Wilkes, J. (2016). Borg,
omega, and kubernetes. Communications of the ACM, 59(5), 50–57.
[Link]
Burns, B., & Tracey, C. (2018). Managing Kubernetes: Operating Kubernetes
Clusters in the Real World. In Managing Kubernetes: Operating
Kubernetes Clusters in the Real World.
Cegieta, R. (2006). Selecting technology for disaster recovery. Proceedings of
International Conference on Dependability of Computer Systems,
DepCoS-RELCOMEX 2006, 160–167. [Link]
RELCOMEX.2006.49
Chandrasekaran, A. (2020a). Best Practices for Running Containers and
Kubernetes in Production.
Chandrasekaran, A. (2020b). Best Practices for Running Containers and
Kubernetes in Production. Gartner, August, 1–14.
[Link]
Costello, K., & Rimol, M. (2021, April 21). Gartner Forecasts Worldwide Public
Cloud End-User Spending to Grow 23% in 2021.
[Link]
gartner-forecasts-worldwide-public-cloud-end-user-spending-to-grow-23-
percent-in-2021
de Souza Couto, R., Secci, S., Elias Mitre Campista, M., & Henrique Maciel
Kosmalski Costa, L. (2014). Network Design Requirements for Disaster
Resilience in IaaS Clouds. [Link]
Disaster recovery planning guide | Cloud Architecture Center | Google
Cloud. (n.d.). Retrieved January 29, 2022, from
[Link]
Eliot, S. (2021, May 14). Disaster Recovery (DR) Architecture on AWS, Part
III: Pilot Light and Warm Standby | AWS Architecture Blog. AWS
Architecture Blog. [Link]
recovery-dr-architecture-on-aws-part-iii-pilot-light-and-warm-standby/
Example: Deploying WordPress and MySQL with Persistent Volumes |
Kubernetes. (n.d.). Retrieved March 10, 2022, from
[Link]
persistent-volume/
Fallara, P. (2004). Disaster Recovery Planning. IEEE Potentials, 23(5), 42–
44. [Link]
geom_density function - RDocumentation. (n.d.). Retrieved March 15, 2022,
from
[Link]
eom_density
GitHub - ahmetb/kubectx: Faster way to switch between clusters and
namespaces in kubectl. (n.d.). Retrieved March 14, 2022, from
[Link]
Google Kubernetes Engine SLA | Google Cloud. (2021).
70
[Link]
Gunawan, A. S., Allen, M., Alhazmi, O. H., & Malaiya, Y. K. (2013). Disaster
Recovery Plans Cloud Evaluating Disaster Recovery Plans Using the
Cloud.
Israel, G. D. (1992). Determining Sample Size 1 The Level of Precision.
University of Florida.
Kirvan, P. (2022, March 9). Cloud-era disaster recovery planning:
Maintenance and continuous improvement.
[Link]
planning-Maintenance-and-continuous-improvement
kubefwd - Kubernetes Service Forwarding. (n.d.). Retrieved March 14, 2022,
from [Link]
kubernetes-sigs/kustomize: Customization of kubernetes YAML
configurations. (n.d.). Retrieved February 23, 2022, from
[Link]
Kubernetes. (n.d.). Retrieved October 30, 2021, from [Link]
Lam, W. (2002). Ensuring business continuity. IT Professional, 4(3), 19–25.
[Link]
Lamouchi, N. (2021). Adding Anti-Disaster Layers. Pro Java Microservices
with Quarkus and Kubernetes, 187–251. [Link]
4842-7170-4_6
Larsson, L., Tärneberg, W., Klein, C., Elmroth, E., & Kihl, M. (2020). Impact of
etcd deployment on Kubernetes, Istio, and application performance.
Software: Practice and Experience, 50(10), 1986–2007.
[Link]
Lozupone, V. (2017). Disaster recovery plan for medical records company.
International Journal of Information Management, 37(6), 622–626.
[Link]
Marshall, M. I., & Schrank, H. L. (2013). Small business disaster recovery: a
research framework. [Link]
Menouer, T. (2020). KCSS: Kubernetes container scheduling strategy. The
Journal of Supercomputing 2020 77:5, 77(5), 4267–4293.
[Link]
Miller, A., & Ciuffo, F. (2021, December 1). Backup and restore your Amazon
EKS cluster resources using Velero | Containers.
[Link]
amazon-eks-cluster-resources-using-velero/
Minh Bui, D. (2020). Implementing cluster backup solution to build resilient
cloud architecture 2020 Laurea.
Oktadini, N. R., & Surendro, K. (2014). SLA in cloud computing: Improving
SLA’s life cycle applying six sigma. 2014 International Conference on
Information Technology Systems and Innovation, ICITSI 2014 -
Proceedings. [Link]
Pereira Ferreira, A., & Sinnott, R. (2019). A performance evaluation of
containers running on managed kubernetes services. Proceedings of the
International Conference on Cloud Computing Technology and Science,
CloudCom, 2019-Decem, 199–208.
[Link]
Poniszewska-Marańda, A., & Czechowska, E. (2021). Kubernetes Cluster for
Automating Software Production Environment. Sensors 2021, Vol. 21,
71
Page 1910, 21(5), 1910. [Link]
Prazeres, A., & Lopes, E. (2013). Disaster Recovery – A Project Planning
Case Study in Portugal. Procedia Technology, 9, 795–805.
[Link]
Quarantelli, E. L. (1999). The Disaster Recovery Process: What We Know
And Do Not Know From Research.
[Link]
Regional clusters | Kubernetes Engine Documentation | Google Cloud.
(n.d.). Retrieved March 24, 2022, from
[Link]
clusters
Robinson, G., Narin, A., & Elleman, C. (2014). Amazon Web Services-Using
AWS for Disaster Recovery Using Amazon Web Services for Disaster
Recovery.
roboll/helmfile: Deploy Kubernetes Helm Charts. (n.d.). Retrieved February
13, 2022, from [Link]
Rudolph, C. G. (1990). Business Continuation Planning/Disaster Recovery: A
Marketing Perspective. IEEE Communications Magazine, 28(6), 25–28.
[Link]
Run a Replicated Stateful Application | Kubernetes. (n.d.). Retrieved March
24, 2022, from [Link]
replicated-stateful-application/
Sahi, A., Lai, D., & Li, Y. (2016). Security and privacy preserving approaches
in the eHealth clouds with disaster recovery plan. Computers in Biology
and Medicine, 78, 1–8.
[Link]
Schrettenbrunner, J. (2020). Migrating Pods in Kubernetes.
[Link]
_Kubernetes
Suguna, S., & Suhasini, A. (2015). Overview of data backup and disaster
recovery in cloud. 2014 International Conference on Information
Communication and Embedded Systems, ICICES 2014.
[Link]
Symantec 2010 Disaster Recovery Study. (2010).
Takabi, H., Joshi, J. B. D., & Ahn, G. J. (2010). Security and privacy
challenges in cloud computing environments. IEEE Security and Privacy,
8(6), 24–31. [Link]
Tamimi, A. A., Dawood, R., & Sadaqa, L. (2019). Disaster recovery
techniques in cloud computing. 2019 IEEE Jordan International Joint
Conference on Electrical Engineering and Information Technology, JEEIT
2019 - Proceedings, 845–850.
[Link]
Tomlinson, B. (n.d.). darthlukan/rhacm-mirror: An OpenShift/Kubernetes
operator which orchestrates automatic failover of one RHACM hub to
another. Retrieved March 16, 2022, from
[Link]
Velero. (n.d.). Retrieved February 12, 2022, from [Link]
Velero Plugins. (n.d.). Retrieved March 17, 2022, from
[Link]
What is Terraform? | IBM. (n.d.). Retrieved February 13, 2022, from
72
[Link]
Wiboonrat, M. (2008a). An empirical IT contingency planning model for
disaster recovery strategy selection. IEMC-Europe 2008 - 2008 IEEE
International Engineering Management Conference, Europe: Managing
Engineering, Technology and Innovation for Growth.
[Link]
Wiboonrat, M. (2008b). An empirical IT contingency planning model for
disaster recovery strategy selection. IEMC-Europe 2008 - 2008 IEEE
International Engineering Management Conference, Europe: Managing
Engineering, Technology and Innovation for Growth.
[Link]
Wood, T., Cecchet, E., Ramakrishnan, K. K., Shenoy, P., Merwe, J. van der,
& Venkataramani, A. (2010). Disaster recovery as a cloud service:
economic benefits & deployment challenges. HotCloud’10: Proceedings
of the 2nd USENIX Conference on Hot Topics in Cloud Computing, 8.
Xu, C., Rajamani, K., & Felter, W. (2018). NBWGuard: Realizing network QoS
for kubernetes. Middleware Industry 2018 - Proceedings of the 2018
ACM/IFIP/USENIX Middleware Conference (Industrial Track), 32–38.
[Link]
Zhang, X., & McMurray, A. J. (2012). Embedding Business Continuity and
Disaster Recovery within Risk Management. SSRN Electronic Journal.
[Link]
73
Appendix 1
Project proposal
Security and monitoring are anti-disaster layers for Kubernetes clusters, but
even with the application of these concepts, the application still faces many
risks, such as high availability (Lamouchi, 2021). This is the reason why
Disaster Recovery is critical for guaranteeing the agreed Service-Level
Agreements (SLAs) and Service-Level Objectives (SLOs).
The aim of the project is to research, explore and evaluate the disaster recovery
solutions available for Kubernetes running in the cloud, as a managed service.
This will involve measuring the RTO (Recovery Time Objective) and the RPO
(Recovery Point Objective) as our objective metrics (Baginda et al., 2018).
74
• Project outline for the work that you propose to complete
The main research questions that this work will address include:
How to decrease the RTO and RPO of a fully production Kubernetes cluster
after a disaster in the cloud? Where are the limits and consequences on
employing the identified technologies?
• References
Al-Kiswany, S., Subhraveti, D., Sarkar, P., & Ripeanu, M. (2011). VMFlock: Virtual
machine co-migration for the cloud. Proceedings of the IEEE International
Symposium on High Performance Distributed Computing, 159–170.
[Link]
Alhazmi, O. H., & Malaiya, Y. K. (2012). Assessing disaster recovery alternatives: On-
site, colocation or cloud. Proceedings - 23rd IEEE International Symposium on
75
Software Reliability Engineering Workshops, ISSREW 2012, 19–20.
[Link]
Alhazmi, O. H., & Malaiya, Y. K. (2013). Evaluating disaster recovery plans using the
cloud. Proceedings - Annual Reliability and Maintainability Symposium.
[Link]
Alvarez-Parmar, R. (2020, December 7). Operating a multi-regional stateless
application using Amazon EKS | Containers.
[Link]
stateless-application-using-amazon-eks/
Amarnath, A. (2020, September 16). Velero 1.5: Auto volume backup with restic,
DeleteItemAction plugins, Restore Hooks, and much more!
[Link]
Amazon EKS Service Level Agreement. (2020). [Link]
Anand, G., & Kodali, R. (2008). Benchmarking the benchmarking models.
Benchmarking, 15(3), 257–291.
[Link]
Andrade, E., Nogueira, B., Matos, R., Callou, G., & Maciel, P. (2017). Availability
modeling and analysis of a disaster-recovery-as-a-service solution. Computing,
99(10), 929–954. [Link]
As Quarterly Cloud Spending Jumps to Over $50B, Microsoft Looms Larger in
Amazon’s Rear Mirror | Synergy Research Group. (2022, February 3).
[Link]
over-50b-microsoft-looms-larger-in-amazons-rear-mirror
Backup and Restore with Velero | Administration Guide | SUSE CaaS Platform 4.2.4.
(n.d.). Retrieved April 2, 2022, from [Link]
caasp/4.2/html/caasp-admin/[Link]
Backup for GKE | Google Cloud. (n.d.). Retrieved March 16, 2022, from
[Link]
gke/concepts/backup-for-gke
Baginda, Y. P., Affandi, A., & Pratomo, I. (2018). Analysis of RTO and RPO of a service
stored on Amazon Web Service (AWS) and Google Cloud Engine (GCE).
Proceedings of 2018 10th International Conference on Information Technology
and Electrical Engineering: Smart Technology for Better Society, ICITEE 2018,
418–422. [Link]
Bakshi, D., & Kim, B. (2021, November 12). Disaster Recovery with AWS Managed
Services, Part I: Single Region | AWS Architecture Blog.
[Link]
managed-services-part-i-single-region/
Balla, D., Simon, C., & Maliosz, M. (2020). Adaptive scaling of Kubernetes pods.
Proceedings of IEEE/IFIP Network Operations and Management Symposium
2020: Management in the Age of Softwarization and Artificial Intelligence,
NOMS 2020. [Link]
Burns, B., Grant, B., Oppenheimer, D., Brewer, E., & Wilkes, J. (2016). Borg, omega,
and kubernetes. Communications of the ACM, 59(5), 50–57.
[Link]
Burns, B., & Tracey, C. (2018). Managing Kubernetes: Operating Kubernetes Clusters
in the Real World. In Managing Kubernetes: Operating Kubernetes Clusters in
76
the Real World.
Cegieta, R. (2006). Selecting technology for disaster recovery. Proceedings of
International Conference on Dependability of Computer Systems, DepCoS-
RELCOMEX 2006, 160–167. [Link]
RELCOMEX.2006.49
Chandrasekaran, A. (2020a). Best Practices for Running Containers and Kubernetes in
Production.
Chandrasekaran, A. (2020b). Best Practices for Running Containers and Kubernetes
in Production. Gartner, August, 1–14.
[Link]
Costello, K., & Rimol, M. (2021, April 21). Gartner Forecasts Worldwide Public Cloud
End-User Spending to Grow 23% in 2021.
[Link]
forecasts-worldwide-public-cloud-end-user-spending-to-grow-23-percent-in-
2021
de Souza Couto, R., Secci, S., Elias Mitre Campista, M., & Henrique Maciel Kosmalski
Costa, L. (2014). Network Design Requirements for Disaster Resilience in IaaS
Clouds. [Link]
Disaster recovery planning guide | Cloud Architecture Center | Google Cloud.
(n.d.). Retrieved January 29, 2022, from
[Link]
Eliot, S. (2021, May 14). Disaster Recovery (DR) Architecture on AWS, Part III: Pilot
Light and Warm Standby | AWS Architecture Blog. AWS Architecture Blog.
[Link]
on-aws-part-iii-pilot-light-and-warm-standby/
Example: Deploying WordPress and MySQL with Persistent Volumes | Kubernetes.
(n.d.). Retrieved March 10, 2022, from
[Link]
persistent-volume/
Fallara, P. (2004). Disaster Recovery Planning. IEEE Potentials, 23(5), 42–44.
[Link]
geom_density function - RDocumentation. (n.d.). Retrieved March 15, 2022, from
[Link]
m_density
GitHub - ahmetb/kubectx: Faster way to switch between clusters and namespaces in
kubectl. (n.d.). Retrieved March 14, 2022, from
[Link]
Google Kubernetes Engine SLA | Google Cloud. (2021).
[Link]
Gunawan, A. S., Allen, M., Alhazmi, O. H., & Malaiya, Y. K. (2013). Disaster Recovery
Plans Cloud Evaluating Disaster Recovery Plans Using the Cloud.
Israel, G. D. (1992). Determining Sample Size 1 The Level of Precision. University of
Florida.
Kirvan, P. (2022, March 9). Cloud-era disaster recovery planning: Maintenance and
continuous improvement. [Link]
era-disaster-recovery-planning-Maintenance-and-continuous-improvement
kubefwd - Kubernetes Service Forwarding. (n.d.). Retrieved March 14, 2022, from
77
[Link]
kubernetes-sigs/kustomize: Customization of kubernetes YAML configurations. (n.d.).
Retrieved February 23, 2022, from [Link]
sigs/kustomize
Kubernetes. (n.d.). Retrieved October 30, 2021, from [Link]
Lam, W. (2002). Ensuring business continuity. IT Professional, 4(3), 19–25.
[Link]
Lamouchi, N. (2021). Adding Anti-Disaster Layers. Pro Java Microservices with
Quarkus and Kubernetes, 187–251. [Link]
4_6
Larsson, L., Tärneberg, W., Klein, C., Elmroth, E., & Kihl, M. (2020). Impact of etcd
deployment on Kubernetes, Istio, and application performance. Software:
Practice and Experience, 50(10), 1986–2007. [Link]
Lozupone, V. (2017). Disaster recovery plan for medical records company.
International Journal of Information Management, 37(6), 622–626.
[Link]
Marshall, M. I., & Schrank, H. L. (2013). Small business disaster recovery: a research
framework. [Link]
Menouer, T. (2020). KCSS: Kubernetes container scheduling strategy. The Journal of
Supercomputing 2020 77:5, 77(5), 4267–4293. [Link]
020-03427-3
Miller, A., & Ciuffo, F. (2021, December 1). Backup and restore your Amazon EKS
cluster resources using Velero | Containers.
[Link]
eks-cluster-resources-using-velero/
Minh Bui, D. (2020). Implementing cluster backup solution to build resilient cloud
architecture 2020 Laurea.
Oktadini, N. R., & Surendro, K. (2014). SLA in cloud computing: Improving SLA’s life
cycle applying six sigma. 2014 International Conference on Information
Technology Systems and Innovation, ICITSI 2014 - Proceedings.
[Link]
Pereira Ferreira, A., & Sinnott, R. (2019). A performance evaluation of containers
running on managed kubernetes services. Proceedings of the International
Conference on Cloud Computing Technology and Science, CloudCom, 2019-
Decem, 199–208. [Link]
Poniszewska-Marańda, A., & Czechowska, E. (2021). Kubernetes Cluster for
Automating Software Production Environment. Sensors 2021, Vol. 21, Page
1910, 21(5), 1910. [Link]
Prazeres, A., & Lopes, E. (2013). Disaster Recovery – A Project Planning Case Study in
Portugal. Procedia Technology, 9, 795–805.
[Link]
Quarantelli, E. L. (1999). The Disaster Recovery Process: What We Know And Do Not
Know From Research. [Link]
Regional clusters | Kubernetes Engine Documentation | Google Cloud. (n.d.).
Retrieved March 24, 2022, from [Link]
engine/docs/concepts/regional-clusters
Robinson, G., Narin, A., & Elleman, C. (2014). Amazon Web Services-Using AWS for
78
Disaster Recovery Using Amazon Web Services for Disaster Recovery.
roboll/helmfile: Deploy Kubernetes Helm Charts. (n.d.). Retrieved February 13, 2022,
from [Link]
Rudolph, C. G. (1990). Business Continuation Planning/Disaster Recovery: A
Marketing Perspective. IEEE Communications Magazine, 28(6), 25–28.
[Link]
Run a Replicated Stateful Application | Kubernetes. (n.d.). Retrieved March 24, 2022,
from [Link]
application/
Sahi, A., Lai, D., & Li, Y. (2016). Security and privacy preserving approaches in the
eHealth clouds with disaster recovery plan. Computers in Biology and Medicine,
78, 1–8. [Link]
Schrettenbrunner, J. (2020). Migrating Pods in Kubernetes.
[Link]
ernetes
Suguna, S., & Suhasini, A. (2015). Overview of data backup and disaster recovery in
cloud. 2014 International Conference on Information Communication and
Embedded Systems, ICICES 2014. [Link]
Symantec 2010 Disaster Recovery Study. (2010).
Takabi, H., Joshi, J. B. D., & Ahn, G. J. (2010). Security and privacy challenges in cloud
computing environments. IEEE Security and Privacy, 8(6), 24–31.
[Link]
Tamimi, A. A., Dawood, R., & Sadaqa, L. (2019). Disaster recovery techniques in cloud
computing. 2019 IEEE Jordan International Joint Conference on Electrical
Engineering and Information Technology, JEEIT 2019 - Proceedings, 845–850.
[Link]
Tomlinson, B. (n.d.). darthlukan/rhacm-mirror: An OpenShift/Kubernetes operator
which orchestrates automatic failover of one RHACM hub to another. Retrieved
March 16, 2022, from [Link]
Velero. (n.d.). Retrieved February 12, 2022, from [Link]
Velero Plugins. (n.d.). Retrieved March 17, 2022, from [Link]
What is Terraform? | IBM. (n.d.). Retrieved February 13, 2022, from
[Link]
Wiboonrat, M. (2008a). An empirical IT contingency planning model for disaster
recovery strategy selection. IEMC-Europe 2008 - 2008 IEEE International
Engineering Management Conference, Europe: Managing Engineering,
Technology and Innovation for Growth.
[Link]
Wiboonrat, M. (2008b). An empirical IT contingency planning model for disaster
recovery strategy selection. IEMC-Europe 2008 - 2008 IEEE International
Engineering Management Conference, Europe: Managing Engineering,
Technology and Innovation for Growth.
[Link]
Wood, T., Cecchet, E., Ramakrishnan, K. K., Shenoy, P., Merwe, J. van der, &
Venkataramani, A. (2010). Disaster recovery as a cloud service: economic
benefits & deployment challenges. HotCloud’10: Proceedings of the 2nd USENIX
Conference on Hot Topics in Cloud Computing, 8.
79
Xu, C., Rajamani, K., & Felter, W. (2018). NBWGuard: Realizing network QoS for
kubernetes. Middleware Industry 2018 - Proceedings of the 2018
ACM/IFIP/USENIX Middleware Conference (Industrial Track), 32–38.
[Link]
Zhang, X., & McMurray, A. J. (2012). Embedding Business Continuity and Disaster
Recovery within Risk Management. SSRN Electronic Journal.
[Link]
80
Appendix 2
Project Planning
• Project plan
• Project Diary
Supervisor’s Comments:
Mindset completely changed about the project idea, as this is not really a topic
for Research per se. This would involve asking potential users about
functionality and applying just what the people wanted. This has lots of risks,
and it would be wiser to change topic. He suggested me to focus just on one
81
topic that can be researchable, not going through the whole project of Market
research + R Shiny development + Shiny deployment. Perhaps a good topic
is exploring how Shiny and DevOps glue together, as perhaps it could be
interesting for companies.
Progress:
Felt a little overwhelmed with the many possible research topics, and
selecting one adequate to me, where I could feel thrilled.
Tried to test some research topic regarding minikube and some disaster
recovery plan. I talked with my company manager to select a topic and we
could think of some interesting for the company, around disaster recovery.
Supervisor’s Comments:
Maybe focus on just this, Disaster Recovery, with a given disaster. For
example, find in the literature that 80% of companies suffered one type of
disaster. Focus on what are the risks. Also focus on the mitigation steps and
how to mitigate prematurely the risks. Could a user interface be useful?
Start by studying the background area, literature, and understand the
problems that the area is facing.
82
- How to manage the fact that currently there is single AZ cluster… some
of these problems would go away with the regional clusters.
Tell Paul that I ditched Azure because of different problems regarding budget
and complexity for the access.
Progress:
Initial report finished and sent; I wrote a little bit of the introduction for the
Dissertation and started with the chapter 3.
Supervisor’s Comments:
Regarding the questions:
- About length of the dissertation: 10K or 20K. Not exact number. The
real importance is about reasoning, not length.
- In the methodology part I should propose my experiment, design it.
Design the methods by which the research is succeeded. Design the
scenarios, how I implemented it, screenshots and diagrams
- Publishing the results in GitHub is a bad idea. Better after presenting
the Dissertation.
- The problem of multi-AZ vs single-AZ in disaster recovery, obviously
multi-AZ is better, but I have to focus on the steps after and how to
improve it, whatever the setting.
Progress:
The chapter 3 about methodology was completely finished and reviewed by
Paul
Supervisor’s Comments:
Try to describe the process of setting up the cluster in both chapters, 3 and 4,
as I have not explained it.
Using statistical methods to calculate sample size, given the fact that there is
no paper mentioning such a benchmark. And thereforem we can argument
why have we chose such number of experiments.
One via could be C-SCORE [Link]
research/ population size
Regarding mentioning Claranet in the dissertation: I would just need verbal
justification from the company.
Focus on the conclusion and ask these questions: What can you improve?
What are the main findings?
Progress:
84
Finished chapter 3 and addressed all the comments from Paul. I’m halfway
through chapter 4 now, describing the cluster deployment
Supervisor’s Comments:
Regarding sample size: Increase scenario 2 tests at least with a few more
samples. Let’s try to use another formula to calculate the sample size.
If the scripts are long, better to put that text in the appendix, otherwise explain
in chapter 4.
Include please pictures in chapter 4.
Evaluation in chapter 5: Compare to other Disaster Recovery solutions that I
found.
Progress:
Almost with chapter 4 finished, and writing Appendix 3.
Supervisor’s Comments:
Explain the sample size calculations in evaluation. Bring it up in
methodologies too and explain that it is not feasible to do this number of tests.
Use median instead of mean in the charts
Perform t-tests in the scenarios presented, comparing AWS and GCP, to
know if there are significant differences in both collections
Regarding the sample size: Test using minutes or hours instead of seconds,
because it should not change.
85
Appendix 3
Two main directories have been developed for both environments (AWS and
GCP).
Inside each directory, there are likewise two other directories. The first one
takes care about setting up the Kubernetes cluster, and the second one
consists of auxiliary services.
• EKS files
Beginning with the Kubernetes cluster in AWS, known as EKS, the following
files have been developed:
The following file is the “[Link]” file, which configures basic information
like the AWS region to be used, and where the Terraform state is to be saved.
provider "aws" {
region = [Link]
}
provider "aws" {
alias = "paris"
region = "eu-west-3"
}
terraform {
backend "local" {
path = "[Link]"
}
}
variable "project_account_id" {
default = "REMOVED DUE TO PRIVACY CONCERNS"
}
variable "region" {
default = "eu-west-3"
}
variable "availability_zone" {
default = {
86
"0" = "eu-west-3a"
#"1" = "eu-west-3b"
#"2" = "eu-west-3c"
}
}
The following file is the “[Link]” file, which creates the Virtual Private Cloud
(VPC). This will hold the network connectivity of the cluster. It configures the
public and private subnetworks and makes possible through a NAT and an
Internet Gateway the access from external sources. It also sets routing tables,
including the endpoint needed for the S3 bucket.
### SUBNETS
resource "aws_subnet" "public" {
for_each = var.public_cidr
vpc_id = aws_vpc.[Link]
cidr_block = [Link].cidr_block
map_public_ip_on_launch = "true"
availability_zone_id = [Link].availability_zone_id
tags = {
Name = var.subnet_public
}
}
87
### ROUTE TABLES
resource "aws_route_table" "public" {
vpc_id = aws_vpc.[Link]
route {
cidr_block = "[Link]/0"
gateway_id = aws_internet_gateway.[Link]
}
tags = {
Name = "Public"
}
}
route {
cidr_block = "[Link]/0"
nat_gateway_id = [Link]
}
tags = {
Name = "Private"
}
}
Along the previous file, this “[Link]” is the file which holds the values used
in the [Link] file. It sets values like naming, IP ranges, and the zone to be used.
#### VPC
variable "vpc_name" {
default = "sergio-test"
}
variable "vpc_cidr" {
default = "[Link]/21"
}
#### SUBNETS
variable "subnet_public" {
default = "public"
}
variable "public_cidr" {
default = {
"eu-west-3a" = {
availability_zone = "eu-west-3a"
cidr_block = "[Link]/24"
availability_zone_id = "euw3-az1"
}
}
88
}
variable "subnet_private" {
default = "private"
}
variable "private_cidr" {
default = {
"eu-west-3a" = {
availability_zone = "eu-west-3a"
cidr_block = "[Link]/24"
availability_zone_id = "euw3-az1"
}
}
}
Then, the next file is `[Link]`, which will configure resources related to principals
and its permissions. Firstly, the role for the master node is created and it is
assigned the required permissions to run the cluster. The role for the worker
node is created as well, with more restricted permissions. Then, the role for
Velero is created, and the OIDC identity provider is set up for it to access S3
through the service account present in the cluster.
assume_role_policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "[Link]"
},
"Action": "sts:AssumeRole"
}
]
}
POLICY
}
# worker nodes
resource "aws_iam_role" "eks-worker-role" {
name = "eks-worker-role"
assume_role_policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "[Link]"
},
"Action": "sts:AssumeRole"
}
89
]
}
POLICY
}
90
"StringEquals": {
"${trimprefix(aws_eks_cluster.[Link],
"[Link] "system:serviceaccount:velero:velero"
}
}
}
]
}
EOF
}
output "endpoint" {
value = aws_eks_cluster.[Link]
}
91
issuer_url = aws_eks_cluster.[Link]
}
}
# OpenID Provider
resource "aws_iam_openid_connect_provider" "sergio-test" {
client_id_list = ["[Link]"]
thumbprint_list = ["9e99a48a9960b14926bb7f3b02e22da2b0ab7280"]
#CAB073498D7558FEC3B2C414C006ACBA30805431
url = aws_eks_cluster.[Link]
}
• GKE files
Continuing with the Kubernetes cluster in GCP, known as GKE, the following
files have been developed:
The following file has been named “[Link]”, and configures basic
information like the GCP region to be used, and the main variables to be set
throughout the folder.
provider "google" {
project = var.gcp_project_id
region = var.gcp_default_region
zone = var.gcp_default_zone
}
variable "gcp_project_id" {
default = "claranet-playground"
}
variable "gcp_default_region" {
default = "europe-west1"
}
variable "gcp_default_zone" {
default = "europe-west1-b"
92
}
locals {
vpc = {
node_subnet_ip_range = "[Link]/22"
pod_subnet_ip_range = "[Link]/16"
service_subnet_ip_range = "[Link]/23"
pod_subnet_name = "gke-pod-alias-ips"
}
node_nat_ports_per_vm = 1024
pod_nat_ports_per_vm = 64
fw_mgmt_sources = ["[Link]/0"]
cluster = {
name = "sergio-test"
min_master_version = "1.21.6-gke.1500"
master_ipv4_cidr_block = "[Link]/28"
daily_maintenance = "03:00"
tags = ["gke-test"]
node_disk_size_gb = 20
node_disk_type = "pd-standard"
node_image_type = "COS"
node_permissions = [
"[Link]
"[Link]
"[Link]
"[Link]
]
}
preemtible = {
node_version = "1.21.5-gke.1302"
initial_node_count = 1
machine_type = "n2-standard-2"
}
}
The next file, called “[Link]” file, also configures basic information,
mainly, where the Terraform state is to be saved, which will be locally.
terraform {
required_version = ">= 0.14"
backend "local" {
path = "[Link]"
}
required_providers {
local = {
source = "hashicorp/local"
version = "~> 2.1.0"
}
google = {
source = "hashicorp/google"
version = "~> 3.59.0"
}
}
}
In this case, all the required configurations for the setup of the GKE cluster have
been joined in a single file, called “[Link]”. This file will configure the
VPC, the subnetwork for the cluster. Also, a router is set for the node network,
and a public IP address is reserved. Then, a NAT is configured to allow outgoing
traffic with the previous public IP. Once again, a router and an IP address is
reserved for the pod network, and another NAT is configured. Later, a firewall
93
is set to only allow traffic to the required ports. Lastly, the master node and the
worker node are configured.
94
enable = true
filter = "ERRORS_ONLY"
}
}
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
ports = ["22", "80", "443"]
}
source_ranges = local.fw_mgmt_sources
}
95
name = "${[Link]}-stateful-1-21-5-gke-1302"
cluster = google_container_cluster.[Link]
version = [Link].node_version
initial_node_count = [Link].initial_node_count
management {
auto_repair = true
auto_upgrade = false
}
node_config {
machine_type = [Link].machine_type
disk_size_gb = [Link].node_disk_size_gb
disk_type = [Link].node_disk_type
image_type = [Link].node_image_type
oauth_scopes = [Link].node_permissions
preemptible = true
labels = {
node_pool = "preemtible"
}
}
}
Last but not least, the Storage Bucket for Velero is set up, by creating a custom
role for it, the bucket itself, a service account and its binding.
# ======================
# Create custom role for disk/snapshots
# =====================
resource "google_project_iam_custom_role" "velero-role" {
role_id = "velero"
title = "Velero Role"
description = "A Role to get disks and create/delete Snaphosts"
permissions = [
"[Link]",
"[Link]",
"[Link]",
"[Link]",
"[Link]",
"[Link]",
"[Link]",
"[Link]",
]
}
# ======================
# The bucket where to save k8s backups
# =====================
resource "google_storage_bucket" "velero-backups-bucket" {
name = "velero-backups-sergio-test"
location = var.gcp_default_region
storage_class = "REGIONAL"
}
# ======================
# The Service Account
# =====================
96
module "velero-service-account" {
source = "git::[Link]
[Link]?ref=0.7.0"
id = "velero-backups"
display_name = "Velero Backups"
dump_iam_json_key = true
roles = ["projects/claranet-playground/roles/velero"]
}
# ======================
# Bind SA to the bucket
# =====================
resource "google_storage_bucket_iam_member" "velero-backups" {
bucket = google_storage_bucket.[Link]
role = "roles/[Link]"
member = "serviceAccount:${[Link]}"
}
97