fabric-samples/test-network-k8s
Tatsuya Sato f174360f14
Update test-network-k8s to support both v2.5 and v3.0 (#1291)
The existing orderer configuration file is incompatible with v3.0,
and the v3.0 configuration does not work with v2.5.
To support both versions, configuration settings have been updated to
use environment variables instead of referencing static configuration
files.

Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
2025-01-16 23:15:00 +00:00
..
config Update test-network-k8s to support both v2.5 and v3.0 (#1291) 2025-01-16 23:15:00 +00:00
docs Add document about how to benchmark the performance using Hyperledger Caliper (#1238) 2024-07-17 17:46:23 +09:00
kube Update test-network-k8s to support both v2.5 and v3.0 (#1291) 2025-01-16 23:15:00 +00:00
scripts make version regex posix compliant so that it works on mac 2024-12-16 16:06:42 -05:00
.gitignore Feature/fabric builder k8s (#739) 2022-05-26 13:52:25 +01:00
network test-network-k8s: bump k8s-builder and couchdb 2024-06-04 12:56:19 -04:00
README.md Update k8s CC builder to v7.2; Use *.localho.st loopback domain; Optionally bind docker reg to 0.0.0.0 (#811) 2022-08-08 12:05:48 +01:00

Kubernetes Test Network

This project re-establishes the Hyperledger test-network as a cloud native application.

Objectives:

  • Provide a simple, one click activity for running the Fabric test network.
  • Provide a reference guide for deploying production-style networks on Kubernetes.
  • Provide a cloud ready platform for developing chaincode, Gateway, and blockchain apps.
  • Provide a Kube supplement to the Fabric CA Operations and Deployment guides.
  • Support a transition to Chaincode as a Service.
  • Support a transition from the Internal, Docker daemon to External Chaincode builders.
  • Run on any Kube.

Fabric, Ahoy!

Prerequisites:

Quickstart

Create a KIND cluster:

./network kind
./network cluster init

or for Rancher / k3s:

export TEST_NETWORK_CLUSTER_RUNTIME=k3s

./network cluster init

Launch the network, create a channel, and deploy the basic-asset-transfer smart contract:

./network up

./network channel create

./network chaincode deploy asset-transfer-basic ../asset-transfer-basic/chaincode-java

Invoke and query chaincode:

./network chaincode invoke asset-transfer-basic '{"Args":["InitLedger"]}'
./network chaincode query  asset-transfer-basic '{"Args":["ReadAsset","asset1"]}'

Access the blockchain with a REST API:

./network rest-easy

Shut down the test network:

./network down 

Tear down the cluster (KIND):

./network unkind

For Rancher: Preferences -> Kubernetes Settings -> Reset Kubernetes OR ...

./network cluster clean

Detailed Guides

DNS Resolution on OSX

Fabric's OSX binaries have been statically linked with the golang go DNS resolver. In some environments, this causes a brief but noticeable delay when issuing peer commands against the test network.

Workarounds to improve DNS resolution time on OSX:

  • Add manual DNS overrides for virtual hosts by adding to /etc/hosts:
127.0.0.1 org0-ca.localho.st
127.0.0.1 org1-ca.localho.st
127.0.0.1 org2-ca.localho.st
127.0.0.1 org0-orderer1.localho.st
127.0.0.1 org0-orderer2.localho.st
127.0.0.1 org0-orderer3.localho.st
127.0.0.1 org1-peer1.localho.st
127.0.0.1 org1-peer2.localho.st
127.0.0.1 org2-peer1.localho.st
127.0.0.1 org2-peer2.localho.st
  • Reduce the system resolver timeout from the default 5s by adding to /etc/resolv.conf:
options: timeout 2
  • Compile the fabric binaries on a Mac and copy build/bin/* outputs to test-network-k8s/bin. Mac native builds are linked against the netdns=cgo DNS resolver, and are not subject to the timeouts associated with the Golang DNS resolver.