The following guide takes you through how to deploy an instance of Restful-booker-platform onto Kubernetes and tie it to a subdomain of automationintesting.online.
The following tools are required:
- Google account
- Access to the restful-booker-platform gcloud project
- Google-cloud-sdk (with the kubectl plugin)
- Docker
- Access to automationintesting.online on Cloudflare
Create the cluster
Firstly, we require a cluster to deploy rbp into
- With your Google account log into the Google Cloud console. Quick link here.
- From the left hand panel head to Kubernetes Engine > Clusters.
- Select ‘Create clusters’
- Set the following credentials
- Name: rbp-team1 (or similar)
- Zone: europe-north1-a
- Number of nodes: 7
- Machine type: small
Setup local access to your cluster
The cluster will take a few minutes to setup, but once it’s created it we will need to pull down the cluster details to our local machine so we can deploy RBP
- Open up a terminal window
- Run the following, replacing CLUSTER_NAME with the name of the cluster you created in the previous step:
gcloud container clusters get-credentials CLUSTER_NAME --region europe-north1-a
- Startup Docker
- Once Docker is loaded, select your cluster from the Docker Icon on Menu > Kubernetes
- Test that you have accessed the correct cluster by running the following in the terminal:
kubectl get pods
You should get no results
Deploy RBP to the cluster
Now we have local access to the cluster, we can deploy RBP into it
- Pull down the latest instance of the RBP Git repo
- Navigate in the terminal to the
.kubes/class
folder
- Run the following, replacing the team number with the team number you are deploying:
kubectl create -f teamX-deploy.yml
- Head back to the gcloud console and head to Network Services > Load balancing and wait for the new load balancer to appear
Set DNS settings to give public access to the RBP instance
- Once the load balancer has been created, click on it to open the load balancer details
- Copy the IP address at the top under ‘Frontend’ (Port not required)
- Select ‘Cloud DNS’ on the left hand side
- Select ‘rbp-zone’ from the DNS list
- Based on the team you are creating add or update the following record set:
- DNS name: teamX.automationintesting.online
- Resource record type: A
- IPv4 address:
- With the DNS set, head over to the automationintesting.online profile on Cloudflare
- Select DNS
- Create the same record set as you did in Cloud DNS in Cloudflare with the following details
- Type: A
- Name: teamX
- IPv4 address:
- TTL: Automatic
- Enable DNS and HTTP proxy