fabric-samples/test-network-k8s
Josh Kneubuhl fd205a1ac0 fix two README / doc bugs
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
2022-05-09 13:43:13 -04:00
..
config Refine README with CPU/RAM/Docker/Rancher limits; Adds a 10s effort to delivery client connection 2022-05-09 13:43:13 -04:00
docs fix two README / doc bugs 2022-05-09 13:43:13 -04:00
kube Someday, somewhere, someone will complain that 128Mi is not enough to run Fabric. 2022-05-09 13:43:13 -04:00
scripts Includes new 'cluster init' target; Prints errors to the STDOUT 2022-05-09 13:43:13 -04:00
.gitignore test-network-k8s : Connect to Fabric services via Nginx Ingress - READY FOR MERGE (#692) 2022-03-31 17:12:51 +01:00
network Includes new 'cluster init' target; Prints errors to the STDOUT 2022-05-09 13:43:13 -04:00
README.md fix two README / doc bugs 2022-05-09 13:43:13 -04: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 basic_1.0 $PWD/../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.vcap.me
127.0.0.1 org1-ca.vcap.me
127.0.0.1 org2-ca.vcap.me
127.0.0.1 org0-orderer1.vcap.me
127.0.0.1 org0-orderer2.vcap.me
127.0.0.1 org0-orderer3.vcap.me
127.0.0.1 org1-peer1.vcap.me
127.0.0.1 org1-peer2.vcap.me
127.0.0.1 org2-peer1.vcap.me
127.0.0.1 org2-peer2.vcap.me
  • 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.