Quorum blockchain deployment on Google Kubernetes Engine

This article will describe the procedure for deploying quorum blockchain on GKE (Google Kubernetes Engine).

Firstly, call qctl to initialise the quorum blockchain. The qctl is a command line tool for creating, running and interacting with a K8s Quorum network. It is from https://github.com/ConsenSys/qubernetes/blob/master/qctl , and can be installed to your compute engine.

qctl init

This step will generate a yaml file called qubernetes.generate.yaml. By default, a 4 nodes blockchain network is initialised, and IBFT consensus is used. The quorum version is 2.7.0.

Secondly, export the qubernetes.generate.yaml path.

export QUBE_CONFIG=<folder>/qubernetes/qubernetes.generate.yaml

Thirdly, generate the quorum network. This command will take some time to download the quorum container images.

qctl generate network --create

Fourthly, export the output folder. The output folder contains a number of quorum yaml files.

export QUBE_K8S_DIR=<folder>/qubernetes/out

The fifth step, create a kubernetes cluster in Google Cloud.

gcloud container clusters create testquorum --num-nodes=4

This command will output the following message if it is successfully completed.

kubeconfig entry generated for testquorum.
testquorum asia-east2-a 1.18.16-gke.502 e2-medium 1.18.16-gke.502 4 RUNNING

For additional check, you can use kubectl to check for current context.

$ kubectl config current-context

The sixth step, deploy the quorum blockchain to kubernetes.

qctl deploy network --wait

This command will take a while. The “qctl deploy” internally calls kubectl apply to deploy configuration to resources. After deployment is successful, the messages will be printed.

Your Quorum network is ready to go!To run the test contract, check the block number and
geth attach to a node in the network, run:
> qctl test contract quorum-node1
> qctl geth exec quorum-node1 'eth.blockNumber'
> qctl geth attach quorum-node1

Then, for connecting to quorum container node, run this command in qubernetes folder (which is cloned from https://github.com/ConsenSys/qubernetes.git).

./connect.sh  <quorum-node1> quorum

Essentially, the connect.sh call kubectl command with the pod name <quorum-node1> and quorum container as parameter.

kubectl exec -it <quorum-node1>  -c quorum  -- /bin/sh

Then, inside the quorum container node, execute:

/ # geth attach $QHOME/dd/geth.ipc

After attaching to geth console, run the eth command

> eth.blockNumber
> exit
/ #

The end.


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store