This folder includes the config files for deploying PeerPrep onto GKE environment.
Before starting the deployment, you must install and configure the following tools to create and manage an GKE cluster.
-
kubectl– A command line tool for working with GKE clusters. Guide -
gcloud– A command line tool for managing Google Cloud resources, including GKE clusters. Guide
You should also have a Google Cloud account and be able to use the Google Cloud Console.
-
Publish your prepared docker images on the Docker registry.
You can use the
docker-compose.ymlin this folder to build the images, just change the target images. -
Update the docker images to be used for the main services in each
deployment.yaml.By default, it will be using our prepared images located in
szelongq/peerprep-<SERVICE_NAME>:latest.
- From the Google Cloud Console, choose or create a new project
- Enable Kubernetes Engine API for your project
- Create an Autopilot cluster using the Google Cloud Console (Refer to: creating-an-auto-pilot-cluster). The Autopilot cluster helps us to manage vertical scaling of resources for us automatically.
- Open up your Terminal and login to the glcloud CLI
gcloud auth login
- Set the project you will be working on
gcloud config set project PROJECT_ID - Get authentication credentials and configure kubectl to interact with your cluster
gcloud container clusters get-credentials CLUSTER_NAME
- Navigate to the
k8sfolder in the cloned repository - Create the
peerprepnamespacekubectl apply -f 01-Namespace/.
- Deploy the services and their endpoints
kubectl apply -f 02-Services/.
- Check that the deployments and services are visible from the console, or run the following commands:
There should be 7 deployments and services in total. They might take some time to start up and become available.
kubectl get deploy kubectl get services
-
Create the HPAs for the main services
kubectl apply -f 03-HPA/.
Take Note: The Matching and Chat Services do not have HPAs due to their reliance on persistent Websocket connections.
-
From the Google Cloud Console, navigate to the
Services & Ingresstab and check that every service have received a static IP address (You might have to wait for a while). -
Update the ConfigMap in
02-Services/00-env-configs.yamlwith the new endpoint IP addresses of:api-gateway-servicematching-servicechat-service
Take note:
REACH_BASE_URLrefers to the api-gateway-service endpoint- Question, Auth and User service endpoints must also be updated with the base address of
api-gateway-service.
-
Apply the updated ConfigMap
kubectl apply -f 02-Services/00-env-configs.yaml
- You should now be able to access Peerprep on the static IP address of the
frontend-service.