How-to: Deploy your first Hyperledger Fabric components with Azure Kubernetes Service (AKS)

Juarez Junior
6 min readFeb 13, 2020
Hyperledger Fabric with the Azure Kubernetes Service template

by Juarez Junior

Introduction

This post provides details about how to use the Azure Kubernetes Service (AKS) template to create your first Hyperledger Fabric (HLF) consortium network on Microsoft Azure. The template allows you to deploy the HLF blockchain network with minimal effort as you just need very basic Azure and HLF knowledge.

You’ll need to have an Azure subscription to perform the steps below. If you do not have an Azure subscription, you can get a free Microsoft Azure account here.

At last, I’m not going to explain what Hyperledger Fabric is nor its components and architecture neither. In case you need an introduction to Hyperledger, please check the official documentation for Hyperledger 1.4.

Just to mention, the version supported by this template is Hyperledger Fabric 1.4.4 and Hyperledger Fabric may be referenced as HLF below.

So without further ado, let’s configure our Hyperledger Fabric Blockchain network.

Deploy the orderer, CA, and peer nodes

To execute the tasks, we’re going to use Azure Portal, so navigate to https://ms.portal.azure.com/ and select Create a resource as shown below:

Create a resource

Then search for Hyperledger Fabric on Azure Kubernetes Service as shown below:

Hyperledger Fabric on Azure Kubernetes Service

The screen for our target template — Hyperledger Fabric on Azure Kubernetes Service — will be shown:

Hyperledger Fabric on Azure Kubernetes Service — template

Select the Create button highlighted above to start the template deployment as required. The template deployment screen will be shown.

We’ll start with the Basics tab and provide the required information below:

  • Subscription: Select the subscription you want to use in order to deploy the HLF network;
  • Resource group: You can create a new resource group or choose an existing one. As you may know, a resource group will group all your resources that will be deployed as part of this template;
  • Region: Select the Azure region where you want to deploy the Azure Kubernetes cluster for your HLF network;
  • Resource Prefix: Prefix for the naming of resources that will be deployed.

You can see the options I defined below:

Basics Step

Next, select the Fabric settings tab as we’re going to provide the HL Fabric settings:

  • Organization Name: The name of the Fabric network founder organization;
  • Fabric network component: You can choose either Ordering Service or Peer Nodes depending on the Blockchain network node you want to deploy. We’re going to start with Ordering Service but later we’ll deploy a Peer Node as well. The next option explains the differences between them and the related options for each;
  • A number of nodes: The ordering service allows 3,5 or 7 at most. For Peer Nodes you can define from 1 up to 10 nodes at most;
  • Fabric Username: Enter the username that will be used for the Fabric CA authentication;
  • Fabric CA password: Enter the password for the Fabric CA authentication;
  • Confirm password: Confirm the Fabric CA password;
  • Certificates: You can use your own self-signed root certificates to configure the Fabric CA. If so, the couple of options below are shown. Otherwise, keep the default Fabric CA option;
  • Root Certificate: Select the file with the root certificate (.pem files);
  • Root Certificate private key: Select the file with the private key of the root certificate (.pem file).

Again you can see the options I defined below:

Fabric settings

Now we’re going to select the Select AKS cluster Settings tab to define the configuration arguments for our Azure Kubernetes cluster.

  • Kubernetes cluster name: The name of the AKS cluster that will be created. This field will be prepopulated based on the resource prefix provided;
  • Kubernetes version: The version of Kubernetes that will be deployed on the cluster;
  • DNS prefix: Domain Name System (DNS) name prefix for your AKS cluster. You’ll use the DNS to connect to the Kubernetes API in order to manage the containers after creating the cluster;
  • Node size: Select 3x Standard DS2 v2 for this exercise;
  • Node count: The desired number of Kubernetes nodes to be deployed. It’s a good idea to align this node count to be at least equal to or more than the number of HLF nodes as specified in the previous tab, Fabric settings.
  • Service principal client ID: Enter the client ID of an existing service principal or create a new one. This is required for AKS authentication. You can see how to create the Service principal here;
  • Service principal client secret: Enter the client secret of the service principal provided by the service principal client ID step above;
  • Confirm client secret: Confirm the service principal client secret;
  • Enable container monitoring: Choose to enable AKS monitoring, which enables the AKS logs to be pushed to the Log Analytics workspace specified;
  • Log Analytics workspace: Log analytics workspace will be populated with the default workspace that is created if monitoring is enabled.

The defined options are below for your reference:

AKS cluster settings
AKS cluster settings

After providing all the above details, select the Review + create tab.

The review and creation trigger the validation for the values you provided.

If your arguments are correct, you will see the screen below:

Validation passed

Now you can click the Create button. The deployment usually takes from 10 to 15 minutes to complete. You can click the Azure notifications icon on the top-right corner to check the progress.

Deployment in progress

As soon as it finishes, you will be notified through the Azure notifications icon on the top-right corner again.

Deployment Succeeded

Now you can select Go to resource group to see all the resources created as part of the template deployment. All the resource names will start with the prefix provided in the Basics tab.

Deployment completed

Now we have to deploy a Peer node. The steps are similar to the ones above, except for the Fabric Network Component option on the Fabric settings tab, where now we have to select the Peer Nodes option instead of Ordering service.

Note that we have a few different options that have to be informed now as shown below:

Peer nodes

All the remaining options on the proceeding tabs are the same ones.

Click Review + create again, provided that it’s also OK, click Create.

Peer Nodes

That’s it! The next blog post will present how to build the consortium, create channels, deploy as well as deploy and test chaincode (aka Blockchain smart contracts). Stay tuned!

Get a free Microsoft Azure account here!

Succeed with blockchain using Azure’s proven three-step approach. Create smarter, more efficient supply chains, reduce fraud, verify transactions more quickly, and create disruptive new business models with Azure Blockchain Services!

Microsoft Azure Blockchain

--

--