I have got the hyperledger fabric blockchain deployed on kubernetes in namespace: hfl-fabric and the client app using fabric-sdk-go is in another namespace: hlf-app. I am using the gateway api to connect and invoke the chaincode. I am able to connect to the gateway, but while
invoking the transactions and getting the network using
gateway.GetNetwork("channel_name"), I am getting the error:
Failed to create new channel client: event service creation failed: could not get chConfig cache reference: QueryBlockConfig failed: QueryBlockConfig failed: queryChaincode failed: Multiple errors occurred: - Transaction processing for endorser [peer1-myorg.hlf-fabric:7051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection on target [peer1-myorg.hlf-fabric:7051]: connection is in TRANSIENT_FAILURE - Transaction processing for endorser [peer2-myorg.hlf-fabric:7051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection on target [peer2-myorg.hlf-fabric:7051]: connection is in TRANSIENT_FAILURE
The connection-profile used by the client app is:
---
name: test-network-MyOrg
version: 1.0.0
client:
organization: MyOrg
connection:
timeout:
peer:
endorser: '300'
organizations:
MyOrg:
mspid: MyOrgMSP
peers:
- peer0-myorg
- peer1-myorg
- peer2-myorg
certificateAuthorities:
- ca-myorg
peers:
peer0-myorg:
url: grpcs://peer0-myorg.hlf-fabric:${P0PORT}
tlsCACerts:
pem: |
${PEERPEM}
grpcOptions:
ssl-target-name-override: peer0-myorg
hostnameOverride: peer0-myorg
peer1-myorg:
url: grpcs://peer1-myorg.hlf-fabric:${P1PORT}
tlsCACerts:
pem: |
${PEERPEM}
grpcOptions:
ssl-target-name-override: peer1-myorg
hostnameOverride: peer1-myorg
peer2-myorg:
url: grpcs://peer2-myorg.hlf-fabric:${P2PORT}
tlsCACerts:
pem: |
${PEERPEM}
grpcOptions:
ssl-target-name-override: peer2-myorg
hostnameOverride: peer2-myorg
certificateAuthorities:
ca-myorg:
url: https://ca-myorg.hlf-fabric:${CAPORT}
caName: ca-myorg
tlsCACerts:
pem:
- |
${CAPEM}
httpOptions:
verify: false
I am able to invoke the chaincode using the cli (in the same namespace as the fabric blockchain namespace: hlf-fabric).
I guess this issue is related to
cross namespace communication in k8s? For this I have used
grpcs://<svc-name>.<namespace>:<port>
The last resort, would be to deploy the fabric blockchain and the app in the same namespace. But I would appreciate if anyone could guide me setting up the connection-profile for the client app which can facilitate the cross namespace communications to the blockchain.