Git Product home page Git Product logo

hgf-k8s-workshop's Introduction

Table of Contents

HGF K8S Workshop

Hyperledger Global Forum workshop on deploying Hyperledger Fabric on Kubernetes in development and production.

You may wish to explore https://github.com/aidtechnology/nephos, which helps automate the deployment of similar examples as presented here.

Workshop flow

Cluster creation

In the workshop we demonstrate how to create a managed K8S cluster on Azure:

export GROUP=hgf-workshop
export LOCATION=westeurope

az group create -n $GROUP -l $LOCATION
az aks create -g $GROUP -n ${GROUP}-aks -s Standard_DS2_v2 --kubernetes-version 1.11.5 --node-count 5
az aks get-credentials -g $GROUP -n ${GROUP}-aks

Then you can install Helm, using

kubectl create -f ./helm-rbac.yaml

helm init --service-account tiller

Finally, add the incubator repository, so you are able to install Kafka, etc.

helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/

helm repo update

Development example

We will start with the dev_example, using Cryptogen to set up the identities and cryptographic material.

This is sufficient for Development purposes and will use a very simple setup of 1 peer and 1 (solo) orderer.

Production example

In the second part of the workshop, prod_example, we will be using the Fabric CA to provide the identities and cryptographic material.

This uses as production-ready setup implementing Certificate Authorities persisting identities to PostgreSQL, multiple peers and multiple (Kafka-consensus) orderers.

Cleanup

If you use Azure AKS, you can just delete the resource group and associated AKS cluster in one fell swoop.

az group delete -n $GROUP

Extra resources

Repositories

Our charts can be found at the official Helm Charts repository:

https://github.com/helm/charts

And also on our own open-source repository:

https://github.com/aidtechnology/at-charts

We also have a repository hosting the Fabric CA client Homebrew installer (for OS X):

https://github.com/aidtechnology/homebrew-fabric-ca

Courses

Blockchain for Business - An Introduction to Hyperledger Technologies, where we have contributed the Hyperledger Composer chapter:

https://www.edx.org/course/blockchain-business-introduction-linuxfoundationx-lfs171x-0

Blockchain for Blockchain Applications on Packt and Udemy:

https://www.packtpub.com/application-development/hyperledger-blockchain-applications-video

https://www.udemy.com/hyperledger-for-blockchain-applications/

FAQ

In progress

hgf-k8s-workshop's People

Contributors

alexvicegrab avatar nicolapaoli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hgf-k8s-workshop's Issues

Clean up namespaces

In the last step of prod_example it will be good to clean up namespaces as well:

kubectl delete namespace cas cert-manager ingress-controller orderers peers

Add incubator repository

By default, Helm doesn't seem to enable the incubator repository, which is used in this step.

The suggestion is to add the following line either after helm init or before installing kafka chart:
helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/

How to enable Ingress and TLS for orderer and peer?

i've tried enabling ingress for orderer and peer by updating helm values for ord1.yaml,ord2.yaml and peer1.yaml
ingress: enabled: true annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/ssl-redirect: "true" nginx.ingress.kubernetes.io/backend-protocol: "GRPCS" certmanager.k8s.io/cluster-issuer: "letsencrypt-staging" path: / hosts: - host_name tls: - secretName: orderer-tls / peer-tls hosts: - host_name
ingress gets assigned to orderer and peer pods but i am not sure how to generate tls certs and key for them i've tried using
fabric-ca-client enroll -m host_name --enrollment.profile tls -d -u http://peer${NUM}:peer${NUM}_pw@localhost:7054 -M peer${NUM}_MSP
fabric-ca-client enroll -m host_name --enrollment.profile tls -d -u https://ord${NUM}:ord${NUM}_pw@localhost:7054 -M ord${NUM}_MSP
it only generates tlscacerts which contains .pem file. how to get .crt and .key file

Issues with tls

Hi There we keep running into different issues regards to tls and ca https control, may i know what's the version of the nignx-ingress, helm, k8s, and cert-manager that you had success with?

Deploy Smart Contract

Do you have any suggestions (or best practices) to deploy a smart contract ?

  • Manually
    • ?
  • Using VS code extension
    • Port forwarding
    • Expose via ingress
    • ...

Issue with v1.3.0 Policies

I found "AdminPrincipal: Role.MEMBER"(the Policies is old, appeared in v1.0.0) in configtx.yaml, and I changed the Policies to v1.3.0 in configtx.yaml,as below like these codes:

        # Policies defines the set of policies at this level of the config tree
        # For organization policies, their canonical path is usually
        #   /Channel/<Application|Orderer>/<OrgName>/<PolicyName>

        Policies:
            Readers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('OrdererMSP.admin')"

However,I failed to create the channel, error info:
image

So, is the Policies always "AdminPrincipal: Role.MEMBER"?
Iโ€˜m so confused, I need your responds sincerely. TY

Creating channel file not found

When trying to run the following command:
kubectl exec -n peers $PEER_POD -- peer channel create -o ord1-hlf-ord.orderers.svc.cluster.local:7050 -c mychannel -f /hl_config/channel/mychannel.tx

I'm getting the return:

2019-07-26 20:31:21.144 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: channel create configuration tx file not found open /hl_config/channel/mychannel.tx: no such file or directory
command terminated with exit code 1

Is anything wrong with my interpretation ?

Install Chaincode

How do we install chaincode after setting up the network in this manner? The official hyperledger documentation uses a docker CLI container that can access the peers. But I don't see an equivalent pod in this kubernetes setup.

Error while installing chaincode on Peer

Hi,
I am getting below error while installing chaincode on the peer in this.
Command - kubectl exec $PEER_POD -n peers -- bash -c 'peer chaincode install -n mycc -v 1.0 -p /var/chaincode/'

Error - error getting chaincode code mycc: command : failed with error: "exec: "go": executable file not found in $PATH"
NOTE - I have placed the chaincode in the docker file system
Do I need to install GO in the peer container or machine, please suggest.
Thanks,

Raft Support

Hi,

is is possible to create this same network with RAFT Consensus. Is so can you just tell me the flow, so that i can start with creating the required changes to deploy a RAFT Orderer System.

Get x509: certificate error when fabric-ca-client enroll

Hi,
We are getting below " x509: certificate is valid for ingress.local" error while trying to enroll ord-admin on rancher 2.0. The error code is below:

admin@hosts:~/hlf/hgf-k8s-workshop/prod_example$ FABRIC_CA_CLIENT_HOME=./config fabric-ca-client enroll -u https://ord-admin:OrdAdm1nPW@$CA_INGRESS -M ./OrdererMSP
2019/07/03 09:54:35 [INFO] TLS Enabled
2019/07/03 09:54:35 [INFO] generating key: &{A:ecdsa S:256}
2019/07/03 09:54:35 [INFO] encoded CSR
Error: POST failure of request: POST https://k8s.blockchain.iii/enroll
{"hosts":["sysadmin-virtual-machine202"],"certificate_request":"-----BEGIN CERTIFICATE REQUEST-----\nMIIBSDCB8AIBADBVMQsw-----END CERTIFICATE REQUEST-----\n"
,"profile":"","crl_override":"","label":"","NotBefore":"0001-01-01T00:00:00Z","NotAfter":"0001-01-01T00:00:00Z","CAName":""}: 
Post https://k8s.blockchain/enroll: x509: certificate is valid for ingress.local, not k8s.blockchain

Is there any suggestion for this error?

Issue with peer join channel on Minikube

Sorry to trouble you again!
I had followed the hgf-k8s-workshop/dev_example's README.md to make one Orderer and one Peer fabric-network many times, but failed again. Unfortunately, I can't find the key to the trouble. it still threw the same error:
image
And I run the command "peer channel list" in the peer container, it also threw the same error.

So please give me a hand, and Thank you very much!

Connecting RESTful api to the network

I deployed the HLF network to the Kubernetes cluster, have installed a chaincode to peers and instantiated it on the channel.

Currently, I am trying to connect my RESTful api that interacts with a peer using the Fabric Node SDK.
I will be very grateful if you give me any guidance on how to proceed.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.