<p>I am currently working with Kubernetes on Google Cloud with a microservice architecture. Where in a cluster I have different Pods and each of them can communicate with the others via curl using a ClusterIp.</p>

<p>My problem is that I need an endpoint of one of these pods to be called from time to time using the ClusterIp. For this I created a CronJob which curls the endpoint of the pod, but it always returns:</p>

<pre><code>curl: (7) Failed to connect to xx.xx.xx.xx port 8080: Connection refused
</code></pre>

<p>This is the yaml of the cronJob.</p>

<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: cronjob-test # name of the CronJob
spec:
  schedule: "*/1 * * * *" # run every minute
  concurrencyPolicy: Replace
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: cronjob-test
              image: appropriate/curl
              args:
              - /bin/sh
              - -c
              - curl -X POST http://${CLUSTER_IP}:${CLUSTER_PORT}/api/test/
          restartPolicy: Never
</code></pre>

<p><code>istio-proxy</code> sidecar is <strong>VERY</strong> slow to start up in comparison to your workload, in which only <code>alpine</code> is included. </p>

<p>This will lead to problems when your workload is already sending out requests, whereas <code>istio-proxy</code> is not yet ready, or even not yet registered in <code>Pilot</code>. This is why it works if you <code>sleep 10</code> before actually sending out the requests.</p>
