<p>I have been trying to deploy a hyperledger fabric model with 3 CAs 1 orderer and 2 peer nodes. I am able to create the channel with OSADMIN command of fabric but when I try to join the channel with peer node, I get Error: <code>error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context......</code> .</p>
<p>Here are the logs from terminal (local host machine):</p>
<pre><code>2021-06-01 06:38:54.509 UTC [common.tools.configtxgen] main -&gt; INFO 001 Loading configuration
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] completeInitialization -&gt; INFO 002 orderer type: etcdraft
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] completeInitialization -&gt; INFO 003 Orderer.EtcdRaft.Options unset, setting to tick_interval:&quot;500ms&quot; election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216 
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] Load -&gt; INFO 004 Loaded configuration: /etc/hyperledger/clipod/configtx/configtx.yaml
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -&gt; INFO 005 Generating genesis block
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -&gt; INFO 006 Creating application channel genesis block
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -&gt; INFO 007 Writing genesis block
cli-dd4cc5fbf-pdcgb
Status: 201
{
    &quot;name&quot;: &quot;commonchannel&quot;,
    &quot;url&quot;: &quot;/participation/v1/channels/commonchannel&quot;,
    &quot;consensusRelation&quot;: &quot;consenter&quot;,
    &quot;status&quot;: &quot;active&quot;,
    &quot;height&quot;: 1
}
cli-dd4cc5fbf-pdcgb
Error: error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context deadline exceeded
command terminated with exit code 1
Error: error getting endorser client for channel: endorser client failed to connect to peer-general:9051: failed to create new connection: context deadline exceeded
command terminated with exit code 1
</code></pre>
<p>One thing to note down here is I am using Kubernetes and service CLUSTER_IP for all the PODS.</p>
<p>here are logs from one of the PEER POD (same for other)</p>
<pre><code>2021-06-01 06:38:42.180 UTC [nodeCmd] registerDiscoveryService -&gt; INFO 01b Discovery service activated
2021-06-01 06:38:42.180 UTC [nodeCmd] serve -&gt; INFO 01c Starting peer with ID=[peer-govt], network ID=[dev], address=[peer-govt:7051]
2021-06-01 06:38:42.180 UTC [nodeCmd] func6 -&gt; INFO 01d Starting profiling server with listenAddress = 0.0.0.0:6060
2021-06-01 06:38:42.180 UTC [nodeCmd] serve -&gt; INFO 01e Started peer with ID=[peer-govt], network ID=[dev], address=[peer-govt:7051]
2021-06-01 06:38:42.181 UTC [kvledger] LoadPreResetHeight -&gt; INFO 01f Loading prereset height from path [/var/hyperledger/production/ledgersData/chains]
2021-06-01 06:38:42.181 UTC [blkstorage] preResetHtFiles -&gt; INFO 020 No active channels passed
2021-06-01 06:38:56.006 UTC [core.comm] ServerHandshake -&gt; ERRO 021 Server TLS handshake failed in 24.669µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:13258
2021-06-01 06:38:57.007 UTC [core.comm] ServerHandshake -&gt; ERRO 022 Server TLS handshake failed in 17.772µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:29568
2021-06-01 06:38:58.903 UTC [core.comm] ServerHandshake -&gt; ERRO 023 Server TLS handshake failed in 13.581µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:32615
</code></pre>
<p>To overcome this issue, I tried disabling the TLS by setting <code>CORE_PEER_TLS_ENABLED</code> to <code>FALSE</code></p>
<p>then the proposal gets submitted but the orderer POD throws the same error of <code>TLS handshake failed.........</code></p>
<p>Here are the commands I am using to join the channel from cli pod:</p>
<p><code>kubectl -n hyperledger -it exec $CLI_POD -- sh -c &quot;export FABRIC_CFG_PATH=/etc/hyperledger/clipod/config &amp;&amp; export CORE_PEER_LOCALMSPID=GeneralMSP &amp;&amp; export CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/clipod/organizations/peerOrganizations/general.example.com/peers/peer0.general.example.com/tls/ca.crt &amp;&amp; export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/clipod/organizations/peerOrganizations/general.example.com/users/Admin@general.example.com/msp &amp;&amp; export CORE_PEER_ADDRESS=peer-general:9051 &amp;&amp; peer channel join -b /etc/hyperledger/clipod/channel-artifacts/$CHANNEL_NAME.block -o orderer:7050 --tls --cafile /etc/hyperledger/clipod/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem&quot;</code></p>
<p>I am stuck on this problem, any help will be appreciated.
Thank you</p>

Kanha Upadhyay
<p>I have fixed it. The issue I was facing was because of not setting the <code>CORE_PEER_TLS_ENABLED = true</code> for CLI pod.</p>
<p>One thing I have got learn from this whole model, whenever you see TLS issue, first to check for would be checking <code>CORE_PEER_TLS_ENABLED</code> variable. Make sure you have set it for all the pods or containers you are trying to interact with. The case can be false(for no TLS) or true(for using TLS) depending on your deployment.
Other things to keep in mind is using the correct variables of fabric including <code>FABRIC_CFG_PATH</code>, <code>CORE_PEER_LOCALMSPID</code>, <code>CORE_PEER_TLS_ROOTCERT_FILE</code>, <code>CORE_PEER_MSPCONFIGPATH</code> and some others depending on your command.</p>
