This document describes end-to-end deployment process of DecisionRules app for Google Kubernetes Engine.
Prerequisites:
DecisionRules docker images for both client and server.
MongoDB database with administrator access.
GCP account with activated billing account.
If it is first time you work with GCP some services and APIs may be disabled by default, you have to activate them in order to continue.
Mandatory GCP APIs and services:
Kubernetes Engine API
Memorystore
Certificate Manager
Creating Memorystore Redis instance
Click on “Create Instance” on Memorystore page
Set desired configuration of Redis
Click “Create”
Price of Redis instance depends on configuration settings, please think this through before create too powerful and too expensive instances that are not really needed. Cost estimation is on the left side of form.
After creating Redis instance copy primary endpoint IPv4 address. This address will be used for decisionrules/server later.
Creating GKE cluster
Use a Standard cluster, because the Autopilot feature is broken and doesn’t work properly. This is very important and you won't be able toproceed with Autopilot.
Set the name of the cluster
Choose desired Location type
Zonal picks one zone in region
Regional picks one region with all zones included
Choose control plane version
Depends on if you want static GKE version or not.
Configure nodepools
On the Nodes page you can configure which VMs will be deployed in Kubernetes node(s). This depends on the requirements of the system.
Leave disk as is if there are no requirements for specific settings.
Configure Node-pool
Here we choose the number of nodes we want to spin up in our Kubernetes cluster
We can also enable autoscaler and node locations
Click “Create”
Setting up GKE cluster
Connect to the cluster with google cloud shell (recommended) or setup your own SSH connection with your favorite terminal.
Check that you are connected to the right cluster by verifying cluster node that you specified earlier by command:
kubectl get nodes
You should see something like this:
NAME STATUS ROLES AGE VERSION
gke-dr-cluster-1-default-pool-ed5a4901-fkkp Ready <none> 24h v1.25.8-gke.1000 gke-dr-cluster-1-default-pool-ed5a4901-qns3 Ready <none> 24h v1.25.8-gke.1000
You can just redirect the standard output of the echo command to a yaml file in bash or open any editor that your terminal offers (GCP - Active Cloud Shell offers nano afaik).
Then apply these settings:
kubectl apply -f namespace.yaml
kubectl apply -f <file_path> command will be used many times from now and its syntax is always the same.
So every time you read that you should apply something use this command + file creation/editing.
You can verify that your namespace is created by running:
We can check that ingress is up and running by running commad: kubectl get all -n ingress-nginx
You should see something like this:
NAME READY STATUS RESTARTS AGE
pod/ingress-nginx-admission-create-mlvkt 0/1 Completed 0 26h
pod/ingress-nginx-admission-patch-v9b7l 0/1 Completed 0 26h
pod/ingress-nginx-controller-6bc476f787-2xr8g 1/1 Running 0 26h
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/ingress-nginx-controller LoadBalancer XX.XX.XX.XX XX.XXX.XXX.XXX 80:31163/TCP,443:31959/TCP 26h
service/ingress-nginx-controller-admission ClusterIP XX.XX.X.XXX <none> 443/TCP 26h
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/ingress-nginx-controller 1/1 1 1 26h
NAME DESIRED CURRENT READY AGE
replicaset.apps/ingress-nginx-controller-6bc476f787 1 1 1 26h
NAME COMPLETIONS DURATION AGE
job.batch/ingress-nginx-admission-create 1/1 6s 26h
job.batch/ingress-nginx-admission-patch 1/1 6s 26h
Obtain IPv4 address of Ingress for DNS A record:
Run command: kubectl get ingress --namespace=decisionrules
You should see something like this:
NAME CLASS HOSTS ADDRESS PORTS AGE
decisionrules-ingress nginx yourdomain_api.com,yourdomain_app.com XXX.XXX.XXX.XXX 80, 443 26h
Deploy app
Please, be aware of container resource consuptions, because if you exceed your MVs HW limits you wont be able to deploy pods.
For DB security you can add PODs IPs to the network access rules. You can obtain these addresses with command below: