Deploy Applications
At the end of this chapter you would have
-
Deployed Backend API
-
Frontend API
-
Created Virutal Gateway
Pre-requsites
-
You have setup three Kubernetes clusters one for each Management and two meshes
-
You deployed Gloo Mesh on the management cluster
-
You have registered the mesh clusters with management cluster
-
You have Istio installed on the mesh clusters
Environment variables
For a easier and smoother setup, lets define few environment variables that we will refer in the upcoming sections and chapters.
export GLOO_MESH_LICENSE_KEY=<your gloo mesh enterprise license key>(1)
export MGMT=<your management server name>(2)
export CLUSTER1=<your mesh with istio cluster 1>(3)
export CLUSTER2=<your mesh with istio cluster 2>(4)
1 | The Gloo Mesh License Key |
2 | The Kubenretes cluster which will be used Gloo Management Cluster |
3 | The Kubenretes cluster which will be used Gloo Mesh Cluster i.e. where workload will be deployed |
4 | The Kubenretes cluster which will be used Gloo Mesh Cluster i.e. where workload will be deployed |
The cluster mapping are done based on Cloud Components. Adjust as per your cluster setup. |
Backend API
The backend is simple REST API that processes the incoming message and applies some transformations like uppercase, reverse and returns the response with a cloud provider id such as aws
,gcp
,'civo','azure'.
The source of the backend API is available here. |
If you CLUSTER-1
is AWS then,
export AWS=$CLUSTER1
If you CLUSTER-2
is AWS then,
export AWS=$CLUSTER2
kubectl --context="${AWS}" apply -k "$DEMO_HOME/k8s/backend/app/aws"
Wait for the application to be up:
kubectl --context="${AWS}" -n hybrid-cloud rollout status deploy/hybrid-cloud-backend-api --timeout=60s
If you CLUSTER-1
is Azure then,
export AZURE=$CLUSTER1
If you CLUSTER-2
is Azure then,
export AZURE=$CLUSTER2
kubectl --context="${AZURE}" apply -k "$DEMO_HOME/k8s/backend/app/azure"
Wait for the application to be up:
kubectl --context="${AZURE}" -n hybrid-cloud rollout status deploy/hybrid-cloud-backend-api --timeout=60s
If you CLUSTER-1
is Civo then,
export CIVO=$CLUSTER1
If you CLUSTER-2
is Civo then,
export CIVO=$CLUSTER2
kubectl --context="${CIVO}" apply -k "$DEMO_HOME/k8s/backend/app/civo"
Wait for the application to be up:
kubectl --context="${CIVO}" -n hybrid-cloud rollout status deploy/hybrid-cloud-backend-api --timeout=60s
If you CLUSTER-1
is Google Cloud then,
export GCP=$CLUSTER1
If you CLUSTER-2
is Google Cloud then,
export GCP=$CLUSTER2
kubectl --context="$GCP" apply -k "$DEMO_HOME/k8s/backend/app/gcp"
Wait for the application to be up:
kubectl --context="${GCP}" -n hybrid-cloud rollout status deploy/hybrid-cloud-backend-api --timeout=60s
Frontend API
The source of the backend API is available here. |
If you CLUSTER-1
is AWS then,
export AWS=$CLUSTER1
If you CLUSTER-2
is AWS then,
export AWS=$CLUSTER2
Deploy the database,
kubectl --context="${AWS}" apply -k "$DEMO_HOME/k8s/frontend/db"
Wait for the application to be up:
kubectl --context="${AWS}" -n db rollout status deploy/postgresql --timeout=60s
Deploy the API,
kubectl --context="${AWS}" apply -k "$DEMO_HOME/k8s/frontend/app"
Wait for the application to be up:
kubectl --context="${AWS}" -n hybrid-cloud rollout status deploy/hybrid-cloud-frontend-api --timeout=60s
If you CLUSTER-1
is Azure then,
export AZURE=$CLUSTER1
If you CLUSTER-2
is Azure then,
export AZURE=$CLUSTER2
Deploy the database,
kubectl --context="${AWS}" apply -k "$DEMO_HOME/k8s/frontend/db"
Wait for the application to be up:
kubectl --context="${AWS}" -n db rollout status deploy/postgresql --timeout=60s
Deploy the API,
kubectl --context="${AWS}" apply -k "$DEMO_HOME/k8s/frontend/app"
Wait for the application to be up:
kubectl --context="${AWS}" -n hybrid-cloud rollout status deploy/hybrid-cloud-frontend-api --timeout=60s
If you CLUSTER-1
is Civo then,
export CIVO=$CLUSTER1
If you CLUSTER-2
is Civo then,
export CIVO=$CLUSTER2
Deploy the database,
kubectl --context="${AWS}" apply -k "$DEMO_HOME/k8s/frontend/db"
Wait for the application to be up:
kubectl --context="${AWS}" -n db rollout status deploy/postgresql --timeout=60s
Deploy the API,
kubectl --context="${AWS}" apply -k "$DEMO_HOME/k8s/frontend/app"
Wait for the application to be up:
kubectl --context="${AWS}" -n hybrid-cloud rollout status deploy/hybrid-cloud-frontend-api --timeout=60s
If you CLUSTER-1
is Google Cloud then,
export GCP=$CLUSTER1
If you CLUSTER-2
is Google Cloud then,
export GCP=$CLUSTER2
Deploy the database,
kubectl --context="${GCP}" apply -k "$DEMO_HOME/k8s/frontend/db"
Wait for the application to be up:
kubectl --context="${GCP}" -n db rollout status deploy/postgresql --timeout=60s
Deploy the API,
kubectl --context="${GCP}" apply -k "$DEMO_HOME/k8s/frontend/app"
Wait for the application to be up:
kubectl --context="${GCP}" -n hybrid-cloud rollout status deploy/hybrid-cloud-frontend-api --timeout=60s
Virtual Gateway
In order to access the servies we need to configure mesh gateway,
kubectl --context="${MGMT}" apply \
-f "$DEMO_HOME/k8s/frontend/gloo/virtual-gateway.yaml"
Frontend UI
The UI is a react js based Single Page Application which allows users to interact with the API.Clone the repository as shown:
mkdir -p $DEMO_HOME/work
cd $DEMO_HOME/work
git clone https://github.com/kameshsampath/hybrid-cloud-ui.git hybrid-cloud-ui
cd hybrid-cloud-ui
_TODO Frontend app