{"id":20018570,"url":"https://github.com/rupeshtr78/fabric-k8s","last_synced_at":"2025-05-04T23:31:16.905Z","repository":{"id":156959829,"uuid":"196287028","full_name":"rupeshtr78/fabric-k8s","owner":"rupeshtr78","description":"Kubernetes Docker","archived":false,"fork":false,"pushed_at":"2019-07-12T14:10:17.000Z","size":642,"stargazers_count":6,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-04-27T05:36:28.375Z","etag":null,"topics":["chaincode","containers","docker","docker-dind","fabric-network","hyperledger","hyperledger-fabric","kubernetes","kubernetes-deployment"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rupeshtr78.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-10T23:20:04.000Z","updated_at":"2024-06-19T12:17:42.198Z","dependencies_parsed_at":null,"dependency_job_id":"6d2d3853-703c-4f70-82c6-1eceeb8bf5e0","html_url":"https://github.com/rupeshtr78/fabric-k8s","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupeshtr78%2Ffabric-k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupeshtr78%2Ffabric-k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupeshtr78%2Ffabric-k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupeshtr78%2Ffabric-k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rupeshtr78","download_url":"https://codeload.github.com/rupeshtr78/fabric-k8s/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252414225,"owners_count":21744066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chaincode","containers","docker","docker-dind","fabric-network","hyperledger","hyperledger-fabric","kubernetes","kubernetes-deployment"],"created_at":"2024-11-13T08:23:14.898Z","updated_at":"2025-05-04T23:31:11.897Z","avatar_url":"https://github.com/rupeshtr78.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Deploy Hyperledger Fabric Network using Kubernetes \n==================================================\nThe objective of this post is to implement a basic fabric network on\nKubernetes platform.The indent is to understand the architecture behind\nkubernetes deployment of fabric network by going through each step .\n\nWe will be deploy one master node , two worker nodes and a NFS server to\nshare network artifacts and chain code data across the nodes.\n\n\n![](images/K8S-MASTER.png)\n\nKeeping it simple we will be deploying the Hyperledger Fabric network\nconsisting of one organization, maintaining one peer node, one orderer\nwith 'solo' ordering service. We will create a channel , join peer to\nthe channel , install chaincode on peer and instantiate chaincode on\nchannel. Also invoke transactions against the deployed chaincode.\n\n**Installation**\n\nInstall [Kubernetes\n,](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)initialize cluster, add worker nodes to the Kubernetes Cluster.We will mount PersistantVolumes as\nNFS.[Configure](https://help.ubuntu.com/lts/serverguide/network-file-system.html)your NFS file server VM and mount the NFS share on all the nodes.\n\n**Generate the Network Artifacts**\n\nGenerate the network artifacts using configtx.yaml,\ncrypto-config.yaml.If you intent to modify the network topology, change\nthe configuration files (.yaml files) appropriately.\n\nCopy (or use bind) the files from network artifacts , crypto and\nchaincode directory to NFS share.\n\n**Deployment Model**\n\n![K8s Deployment\nModel](images/FABRIC-K8S.png)\n\n***NameSpace***\n\n1.  *fabrick8s*\n\n***Services***\n\n1.  *Orderer*\n2.  *Peer*\n3.  *Docker Dind*\n\n***Deployments***\n\n1.  *Orderer*\n2.  *Peer*\n3.  *Docker Dind ( For ChainCode container Docker in Docker)*\n4.  *CLI For executing peer commands (Optional --- create k8s jobs\n    instead)*\n\n*Persistent Volume Claim*\n\n*Persistent Volume ( NFS)*\n\n**Start the network**\n\nNow lets start the network by running scripts one by one.\n\n\u003e [cd fabric-k8s/k8s](https://github.com/rupeshtr78/fabric-k8s)\n\u003e\n\u003e kubectl create -f 1namespace.yaml\\\n\u003e kubectl create -f 2pv-pvc.yaml\\\n\u003e kubectl create -f 3orderer0-orgorderer1-deploy.yaml\\\n\u003e kubectl create -f 4peer0-org1-deploy.yaml\\\n\u003e kubectl create -f 5docker.yaml\\\n\u003e kubectl create -f 6docker-volume.yaml\\\n\u003e kubectl create -f 7org1-cli-deploy.yaml\\\n\u003e\n\u003e Verify the deployments in the dashboard\n\n![Kubernetes\nDashboard](images/b8s-dashboard.jpeg)\n\n**Create , join , Update Channel** \n----------------------------------\n\n\u003e Manually enter into the CLI.\\\n\u003e kubectl get pods --- all-namespaces\\\n\u003e kubectl exec -it cli-2XXXXX3 bash --- namespace=fabrick8s\\\n\u003e\n\u003e peer channel create -o orderer0-orgorderer1:32000 -c \\$CHANNEL\\_NAME\n\u003e -f ./channel-artifacts/channel.tx --- outputBlock\n\u003e ./channel-artifacts/rtrchannel01.block\n\u003e\n\u003e peer channel fetch newest -o orderer0-orgorderer1:32000 -c\n\u003e \\$CHANNEL\\_NAME\n\u003e\n\u003e peer channel join -b \\${CHANNEL\\_NAME}\\_newest.block\n\n![Kubernetes Dashboard Orderer Pod Logs shows new\nchannel](images/k8s-orderer-logs.jpeg)\n\n**Install ChainCode**\n\n\u003e peer chaincode install -n rtrcc -v 1.0 -p\n\u003e github.com/hyperledger/fabric/examples/chaincode/chaincode\\_example02/go\n\n![**Install\nChainCode**](images/cc-install.jpeg)\n\n**Instantiate ChainCode**\n\n\u003e peer chaincode instantiate -o orderer0-orgorderer1:32000 -C\n\u003e \\$CHANNEL\\_NAME -n rtrcc -v 1.0 -c\n\u003e '{\"Args\":\\[\"init\",\"a\",\"100\\\",\"b\",\"200\\\"\\]}' -P \"AND('Org1MSP.member')\"\n\n![**Instantiate\nChainCode**](images/cc-Instantiate.jpeg)\n\n**Invoke ChainCode**\n\n\u003e peer chaincode invoke -C \\$CHANNEL\\_NAME -n rtrcc -c\n\u003e '{\"Args\":\\[\"invoke\",\"a\",\"b\",\"10\\\"\\]}'\n\u003e\n\u003e peer chaincode query -C \\$CHANNEL\\_NAME -n rtrcc -c\n\u003e '{\"Args\":\\[\"query\",\"a\"\\]}'\n\n![Query\nResult](images/cc-invoke.jpeg)\n\nYou would see that the chain code container is getting started inside\nthe docker-dind pod as a sidecar container.\n\n**References**\n\nhttps://applatix.com/case-docker-docker-kubernetes-part-2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupeshtr78%2Ffabric-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frupeshtr78%2Ffabric-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupeshtr78%2Ffabric-k8s/lists"}