kubernetes-client / kubernetes-client/python

How to reduce the retry count for python client?

Offen
#962 33 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

help wanted kind/bug lifecycle/rotten
Vorherrschende Sprache
Python
Sterne
7.7k
Forks
3.5k
Ø Merge
1 T. 14 Std.
Gemergte PRs (30 T.)
18

Beschreibung

What happened (please include outputs or screenshots):

I am having a config file of a dead/deleted/inaccessible cluster.
I am trying to accessing the cluster using kubernetes-client-python.
By default kube-client retries it 3 times,

WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x00000000096E3860>: 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

After 3 retries it throws an exception.

Is there any way to reduce the count.

Example 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))

What you expected to happen:

I need to configure the retry count for inaccessible/accessible k8s cluster.

How to reproduce it (as minimally and precisely as possible):

Delete the kubernetes cluster, then try to access the cluster using kubernetes-client-python.
By default it will perform retry for 3 times.

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version):
    Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"windows/amd64"}
    Unable to connect to the server: dial tcp 149.129.128.208:6443: connectex: 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.

  • OS: Windows 10

  • Python version (python --version) : Python 2.7.14

  • Python client version (pip list | grep kubernetes): kubernetes 10.0.1

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit den gezeigten Einstiegspunkten config.load_kube_config und CoreV1Api.list_pod_for_all_namespaces und verfolge dann, wie der Client Wiederholungsversuche für einen nicht erreichbaren Cluster durchführt. Als erledigt gilt die Aufgabe, wenn die Anzahl der Wiederholungsversuche für diesen Anwendungsfall konfiguriert werden kann und das unterstützte Verhalten dokumentiert oder anhand des Beispiels verifiziert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
kubernetes, python
Bereich
api, networking
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.