You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reacted by Stephane Odul, Rubén, Santi Agüero, Louis-Paul Dareau, Joel Damata, yeer, Jamie Thompson, Gopinath Sabapathy, Eduardo Roldan, Jacob Henner and 34 more
Calling config.load_kube_config() again doesn't seem to recreate a token in my case, even though the corresponding kubectl command would have automatically done so. So I think there's some staleness check here that isn't actually occurring.
config for an existing client is cached unfortunately :( After calling load_kube_config, you will have to recreate a new api client to pick up the refreshed token. Currently, the expirationTimestamp returned from aws-iam-authenticator is ignored by KubeConfigLoader.
I'm using 11.0.0a1 but still getting intermittent 401's
{"asctime": "2019-11-13 14:38:33,384", "name": "k8s", "levelname": "INFO", "message": "Sleeping for 60 seconds"}
Traceback (most recent call last):
File "src/main.py", line 57, in <module>
drain.run()
File "/opt/git/stratus/stratus-eks/worker_node_rolling_update/src/k8s.py", line 42, in run
self.drain()
File "/opt/git/stratus/stratus-eks/worker_node_rolling_update/src/k8s.py", line 33, in drain
if check_node_drained(self.v1api, node):
File "/opt/git/stratus/stratus-eks/worker_node_rolling_update/src/k8s_helper.py", line 117, in check_node_drained
node_body = api.read_node(node_name)
File "/Users/damatj/.local/share/virtualenvs/worker_node_rolling_update-n2X_lDEC/lib/python3.7/site-packages/kubernetes/client/api/core_v1_api.py", line 20565, in read_node
(data) = self.read_node_with_http_info(name, **kwargs) # noqa: E501
File "/Users/damatj/.local/share/virtualenvs/worker_node_rolling_update-n2X_lDEC/lib/python3.7/site-packages/kubernetes/client/api/core_v1_api.py", line 20649, in read_node_with_http_info
collection_formats=collection_formats)
File "/Users/damatj/.local/share/virtualenvs/worker_node_rolling_update-n2X_lDEC/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 335, in call_api
_preload_content, _request_timeout)
File "/Users/damatj/.local/share/virtualenvs/worker_node_rolling_update-n2X_lDEC/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 166, in __call_api
_request_timeout=_request_timeout)
File "/Users/damatj/.local/share/virtualenvs/worker_node_rolling_update-n2X_lDEC/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 356, in request
headers=headers)
File "/Users/damatj/.local/share/virtualenvs/worker_node_rolling_update-n2X_lDEC/lib/python3.7/site-packages/kubernetes/client/rest.py", line 241, in GET
query_params=query_params)
File "/Users/damatj/.local/share/virtualenvs/worker_node_rolling_update-n2X_lDEC/lib/python3.7/site-packages/kubernetes/client/rest.py", line 231, in request
raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Audit-Id': '96bc2da9-40a0-42b8-9303-3a99b5d77db1', 'Content-Type': 'application/json', 'Date': 'Wed, 13 Nov 2019 19:39:33 GMT', 'Content-Length': '129'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unauthorized","reason":"Unauthorized","code":401}
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
Activity
[-]Refresh auth token periodically[/-][+]Refresh token/api-key periodically[/+]marsewe commentedon Mar 21, 2019
See also kubernetes-sigs/aws-iam-authenticator#63 and https://stackoverflow.com/questions/48151388/kubernetes-python-client-authentication-issue. Should the user of the client catch the 401 (and re-authenticate and retry) or is that a responsibility of the kubernetes-client?
jmeickle commentedon Jun 7, 2019
Calling
config.load_kube_config()again doesn't seem to recreate a token in my case, even though the corresponding kubectl command would have automatically done so. So I think there's some staleness check here that isn't actually occurring.houqp commentedon Aug 5, 2019
config for an existing client is cached unfortunately :( After calling
load_kube_config, you will have to recreate a new api client to pick up the refreshed token. Currently, theexpirationTimestampreturned fromaws-iam-authenticatoris ignored byKubeConfigLoader.wing328 commentedon Aug 8, 2019
@houqp I wonder if you can send the patch upstream to OpenAPI Generator as that's what the project going to use moving forward to generate API clients: kubernetes-client/gen#93
houqp commentedon Aug 8, 2019
Good call @wing328, do you know if #738 and kubernetes-client/gen#97 are the right PRs to watch?
houqp commentedon Aug 8, 2019
@wing328 i have ported the patches to openapi-generator, could you help review them?
roycaihw commentedon Aug 27, 2019
/assign
roycaihw commentedon Sep 18, 2019
kubernetes-client/gen#97 is merged. We used openapi-generator in 11.0.0a1 release #931
jdamata commentedon Nov 13, 2019
I'm using 11.0.0a1 but still getting intermittent 401's
athom commentedon Dec 11, 2019
11.0.0b2also not workfejta-bot commentedon Mar 10, 2020
Issues go stale after 90d of inactivity.
Mark the issue as fresh with
/remove-lifecycle stale.Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with
/close.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
tbarrella commentedon Mar 10, 2020
/remove-lifecycle stale
24 remaining items
Refresh exec-based API credentials when they expire (for Kubernetes c…
Refresh exec-based API credentials when they expire
Refresh exec-based API credentials when they expire
k8s-triage-robot commentedon Oct 18, 2021
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/remove-lifecycle stale/lifecycle rotten/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
dinvlad commentedon Oct 18, 2021
/remove-lifecycle stale
Refresh exec-based API credentials when they expire
xDS interop: Refresh k8s auth on 401 to pick up updated auth token (#…
xDS interop: Refresh k8s auth on 401 to pick up updated auth token (g…
xDS interop: Refresh k8s auth on 401 to pick up updated auth token (#…
xDS interop: Refresh k8s auth on 401 to pick up updated auth token (#…
Refresh exec-based API credentials when they expire
Refresh exec-based API credentials when they expire