<p>I am trying to deploy Hyperledger Fabric on Kubernetes. Everything is working fine other than <code>peer chaincode instantiate</code>. Whenever I try to instantiate chaincode it keeps waiting for around 10-15 mins and then it throws timeout error as shown below:</p>

<pre><code>Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg failed to execute transaction b7ce8fa6259e6004481b829660dd2365f8503153047b3d9132393180e2591f0a: timeout expired while starting chaincode mycc:1.0 for transaction b7ce8fa6259e6004481b829660dd2365f8503153047b3d9132393180e2591f0a
</code></pre>

<p>On the peer side, I get the following error:</p>

<pre><code>2018-08-28 12:55:10.122 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 04e[0m Error creating new Smart Contract: error trying to connect to local peer: context deadline exceeded[31m2018-08-28 12:55:10.121 UTC [shim] userChaincodeStreamGetter -&gt; ERRO 001[0m context deadline exceeded
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 04f[0m error trying to connect to local peer
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 050[0m github.com/hyperledger/fabric/core/chaincode/shim.userChaincodeStreamGetter
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 051[0m  /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:111
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 052[0m github.com/hyperledger/fabric/core/chaincode/shim.Start
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 053[0m  /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:150
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 054[0m main.main
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 055[0m  /chaincode/input/src/github.com/chaincode/fabcar/go/fabcar.go:200
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 056[0m runtime.main
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 057[0m  /opt/go/src/runtime/proc.go:198
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 058[0m runtime.goexit
2018-08-28 12:55:10.123 UTC [dev-peer0.example.com-mycc-1.0] func2 -&gt; INFO 059[0m  /opt/go/src/runtime/asm_amd64.s:2361
2018-08-28 12:55:10.166 UTC [dockercontroller] func2 -&gt; INFO 05a[0m Container dev-peer0.example.com-mycc-1.0 has closed its IO channel
</code></pre>

<p>Full Logs can be found here => <a href="https://hastebin.com/ibukeyakax.coffeescript" rel="nofollow noreferrer">https://hastebin.com/ibukeyakax.coffeescript</a></p>

<p>Any suggestion/help would be really appreciated.</p>

<p>I found the solution. 
Adding <code>CORE_PEER_ADDRESSAUTODETECT</code> variable in env fixed the issue.</p>

<p>So you should add</p>

<pre><code>- name: CORE_PEER_ADDRESSAUTODETECT
  value: "true" 
</code></pre>

<p>into your env</p>
