Google Kubernetes Engine (GKE)

This document describes end-to-end deployment process of DecisionRules app for Google Kubernetes Engine.

Prerequisites:

  1. DecisionRules docker images for both client and server.

  2. MongoDB database with administrator access.

  3. 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:

  1. Kubernetes Engine API

  2. Memorystore

  3. Certificate Manager

Creating Memorystore Redis instance

  1. Click on “Create Instance” on Memorystore page

  2. Set desired configuration of Redis

  3. Click “Create”

After creating Redis instance copy primary endpoint IPv4 address. This address will be used for decisionrules/server later.

Creating GKE cluster

  1. Set the name of the cluster

  2. Choose desired Location type

    1. Zonal picks one zone in region

    2. Regional picks one region with all zones included

  3. Choose control plane version

    1. Depends on if you want static GKE version or not.

  4. Configure nodepools

    1. On the Nodes page you can configure which VMs will be deployed in Kubernetes node(s). This depends on the requirements of the system.

    2. Leave disk as is if there are no requirements for specific settings.

  5. Configure Node-pool

    1. Here we choose the number of nodes we want to spin up in our Kubernetes cluster

    2. We can also enable autoscaler and node locations

  6. 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.

Connect to the cluster with this command:

--zone parameter also accepts regions

Check that you are connected to the right cluster by verifying cluster node that you specified earlier by command:

You should see something like this:

Creating DecisionRules namespace:

Create a yaml file with the following contents:

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 <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.

Install cert-manager

Check that cert-manager is installed properly with kubectl get all -n cert-manager

You should see something like this:

Now apply the ClusterIssuer class

name is important, because you need that for further settings, remember that.

Now apply Issuer class

Now we can apply cert as is described here:

Using google-managed SSL certificates

Install Ingress:

Deploying Ingress:

apply file below

We can check that ingress is up and running by running commad: kubectl get all -n ingress-nginx

You should see something like this:

Obtain IPv4 address of Ingress for DNS A record:

Run command: kubectl get ingress --namespace=decisionrules

You should see something like this:

Deploy app

For DB security you can add PODs IPs to the network access rules. You can obtain these addresses with command below:

kubectl get pod -o wide

Apply changed configuration above.

Then, you can verify that everything is running by running command: kubectl get all -n decisionrules

You should see something like this:

Now just add Ingress IPv4 address to your DNS and its done. App is available on hostname you specified earlier with TLS working.