<p>I need to reduce the retry count for unavailable/deleted kubernetes cluster using kubernetes-client-python, currently by default it is 3.</p>

<pre><code>WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('&lt;urllib3.connection.VerifiedHTTPSConnection object at 0x00000000096E3860&gt;: Failed to establish a new connection: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',)': /api/v1/pods

WARNING Retrying (Retry(total=1,....... /api/v1/pods

WARNING Retrying (Retry(total=0,....... /api/v1/pods
</code></pre>

<p>After 3 retries it throws an exception.</p>

<p>Is there any way to reduce the count.</p>

<p>Example Code</p>

<pre><code>from kubernetes import client, config

config.load_kube_config(config_file='location-for-kube-config')

v1 = client.CoreV1Api()
ret = v1.list_pod_for_all_namespaces()
for i in ret.items:
    print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))


</code></pre>

<p>Sadly it seems that it's not possible because:</p>

<p>Python client use urlib3 PoolManager to make requests as you can see there </p>

<p><a href="https://github.com/kubernetes-client/python/blob/master/kubernetes/client/rest.py#L162" rel="nofollow noreferrer">https://github.com/kubernetes-client/python/blob/master/kubernetes/client/rest.py#L162</a></p>

<pre><code>r = self.pool_manager.request(method, url,
                              body=request_body,
                              preload_content=_preload_content,
                              timeout=timeout,
                              headers=headers)
</code></pre>

<p>and underhood it uses urlopen with default parameters as you can see there</p>

<p><a href="https://urllib3.readthedocs.io/en/1.2.1/pools.html#urllib3.connectionpool.HTTPConnectionPool.urlopen" rel="nofollow noreferrer">https://urllib3.readthedocs.io/en/1.2.1/pools.html#urllib3.connectionpool.HTTPConnectionPool.urlopen</a></p>

<p><code>urlopen(..., retries=3, ...)</code></p>

<p>so there is now way to pass other value here - you must fork official lib to achieve that.</p>
