<p>Updated</p>
<p>I have some script that initializes our service.<br />
The script fails when it runs in the container because of <em><strong>connection refused</strong></em> error in the first outbound request (to external service) in the script.<br />
We tried to add a loop that makes curl and if it fails, re-try, if not - continuous the script.<br />
Sometimes it succeeds for the first time, sometimes it fails 10-15 times in a row.<br />
We recently started using istio<br />
What may be a reason??</p>

Tantre
<p>It is a famous istio bug <a href="https://github.com/istio/istio/issues/11130" rel="nofollow noreferrer">https://github.com/istio/istio/issues/11130</a> ( App container unable to connect to network before Istio's sidecar is fully running) it seems the Istio proxy will not start in parallel , it is waiting for the app container to be ready. a sequential startup sequence as one blogger mentioned (<a href="https://medium.com/@marko.luksa/delaying-application-start-until-sidecar-is-ready-2ec2d21a7b74" rel="nofollow noreferrer">https://medium.com/@marko.luksa/delaying-application-start-until-sidecar-is-ready-2ec2d21a7b74</a>) quote: <code>most Kubernetes users assume that after a pod’s init containers have finished, the pod’s regular containers are started in parallel. It turns out that’s not the case.</code></p>
<p>containers will start in order defined by the Deployment spec YAML.
so the biggest question is will the Istio proxy envoy will start while the first container is stuck in a curl-loop . (egg and chicken problem) .
App container script performs:</p>
<pre><code>until curl --head localhost:15000 ; do echo &quot;Waiting for Istio Proxy to start&quot; ; sleep 3 ; done
</code></pre>
<p>as far as I saw: that script doesn't help a bit. proxy is up but connection to external hostname return &quot;connection refused&quot;</p>
