Deploying Hyperledger Fabric on Kubernetes with Cloudsoft AMP

Cloudsoft AMP has long-standing support for deploying Hyperledger Fabric (HLF) onto a cluster of VMs running Docker in the cloud, but we’ve taken it one step further: now you can deploy HLF onto Kubernetes, one of the most prominent container management solutions available today.

 

Get Started with AMP

We realised that in order to deploy HLF onto Kubernetes, AMP would need to support several new features, such as the ability to specify affinity and anti-affinity between Kubernetes pods. Therefore we have packaged up an early access release of AMP, which includes all of the HLF blueprints and these new Kubernetes deployment capabilities.

To get started, you’ll need to download this EA release of AMP. You can then proceed with the standard AMP installation process which is described step-by-step in our documentation under “OSX / DIY.” Once AMP is installed, download the JAR file from the HLF 0.15.0 release page and copy it into the `deploy` directory of your installed AMP, and then restart AMP.

Kubernetes: Our Way or the Hard Way!

To deploy HLF onto Kubernetes, you’ll need to spin up a Kubernetes cluster of your own. Thankfully, Cloudsoft Container Service (CCS), which automates this fairly complicated process, is bundled with AMP (phew!). For a thorough set of instructions on how to deploy your own Kubernetes cluster, take a look at the CCS documentation. You can also check out a previous blog post that I authored about Kubernetes deployment to learn more about the technical details.

Important note: When deploying your Kubernetes cluster, you’ll need to set the the size of your worker cluster to at least 6, because HLF requires at least 4 validating peer nodes plus two other nodes in order to function properly.

Even though AMP makes the deployment of Kubernetes simple, fast, and repeatable, you are not required to use this feature. If you already have a cluster running or prefer to deploy one using an alternative means, you can still deploy HLF onto that cluster with AMP.

Hyperledger Fabric in a Flash

Once you have a Kubernetes cluster fully deployed, you can proceed with deploying HLF itself, a process that takes only seconds. This represents a major improvement over deploying HLF onto plain VMs running Docker, which requires provisioning the VMs and subsequently installing and configuring Docker on each host (this automated process can take 10+ minutes, depending on the cloud provider).

Simply follow these steps to get your HLF deployment up and running:

  • From the AMP home screen, click on “Blueprint Composer” (tile in top row, second from the right)
  • Click "YAML Editor" (button in top right corner)
  • Copy and paste the Hyperledger catalog file into the editor
  • Click "Add to catalog" (button in bottom right corner)
  • Return to “YAML Editor”
  • Copy and paste the contents of this template blueprint
  • Edit the Kubernetes URL to match your cluster
  • For more information about configuring a Kubernetes cluster location, see this guide
  • Set the number of HLF validating peers by editing the value of `hyperledger.peers`
  • Note that this must be at least 4 in order for HLF to function properly, and the number of Kubernetes worker nodes must be greater than this value by at least 2, for a minimum value of 6 as discussed above
  • Click on “Graphical Designer” at the top right and then click the Hyperledger logo
  • View the visual model, which should closely resemble the photo below
  • Click “Deploy” on the bottom right

Once the rapid deployment process is complete, you will have a Hyperledger Fabric cluster running on Kubernetes!

Head over to “App inspector” from the AMP home screen to view the live model of your deployed cluster.


You can also view those same Fabric components via the UI of your Kubernetes cluster.

Finally, you can manually verify that your Fabric cluster is fully operational and that all nodes have discovered each other. In the AMP “App inspector” navigate to the `hyperledger-validating-peer-service` which can be found under the `hyperledger-root-validating-peer` within the `hyperledger-vp-cluster`. Click on the “Sensors” tag and copy the value of `kubernetes.rest.endpoint.mapped.public` which is the REST endpoint of the root validation peer; it will be in the form of <URL>:<PORT>.

In a terminal window issue the following `curl` command: `curl <URL>:<PORT>/network/peers`. The response should contain the IP addresses of all of your validating peers

A Closer Look at the Blueprint

Now that you know how to deploy HLF onto Kubernetes using Cloudsoft AMP, you may be wondering about what the blueprint looks like under the hood.

The blueprint models each of the components that make up an HLF cluster:

  • The validating peer cluster
  • The membership services node
  • The CLI node

For each of those components, there are two freemarker-templated YAML files which represent Kubernetes resource specifications:

There is also an AMP native YAML file which is responsible for:

  • Wiring the components together
  • Resolving the template values
  • Applying them to the templated Kubernetes resource specification files

The Big Picture

The following diagram (created by Andrew Kennedy) provides a great look at everything we’ve previously discussed, from AMP to the Kubernetes cluster to the Hyperledger Fabric cluster running on top of it.

Up Next

The next blog post in this series will show how to deploy and run chaincode applications on our Hyperledger Fabric cluster using AMP.

Got Questions?

Reach out on our HLF Success Slack channel.