What happened (please include outputs or screenshots):
In [16]: with kubernetes.client.ApiClient(kube_client_config) as api_client:
...: core_api_instance = kubernetes.client.CoreV1Api(api_client)
...: for source in SOURCES:
...: try:
...: resp = core_api_instance.connect_get_node_proxy_with_path(name=node, path=source)
...: except kubernetes.client.exceptions.ApiException:
...: continue
...: print(repr(resp[:10]))
...:
"b'# HELP c"
"b'# HELP a"
What you expected to happen:
In [10]: with kubernetes.client.ApiClient(kube_client_config) as api_client:
...: core_api_instance = kubernetes.client.CoreV1Api(api_client)
...: for source in SOURCES:
...: try:
...: resp = core_api_instance.connect_get_node_proxy_with_path(name=node, path=source)
...: except kubernetes.client.exceptions.ApiException:
...: continue
...: print(repr(resp[:10]))
...:
'# HELP con'
'# HELP agg'
How to reproduce it (as minimally and precisely as possible):
from __future__ import annotations
import kubernetes
kube_client_config = kubernetes.client.Configuration()
KUBECONFIG="/root/.kube/config"
kubernetes.config.load_kube_config(config_file=KUBECONFIG, client_configuration=kube_client_config)
SOURCES = ("/metrics/resource", "/metrics/probe", "/metrics")
node="node001" # use own hostname
with kubernetes.client.ApiClient(kube_client_config) as api_client:
core_api_instance = kubernetes.client.CoreV1Api(api_client)
for source in SOURCES:
try:
resp = core_api_instance.connect_get_node_proxy_with_path(name=node, path=source)
except kubernetes.client.exceptions.ApiException:
continue
print(repr(resp[:10]))
Anything else we need to know?:
Environment:
- Kubernetes version (
kubectl version): v1.35.6
- OS: Linux
- Python version: 3.12
- Python client version: 36.0.2
Rolling-back to v35.0.0 or using client generated by newer OpenApi generator fixes issue
What happened (please include outputs or screenshots):
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
kubectl version): v1.35.6