python
python copied to clipboard
Calling NetworkingV1Api().list_namespaced_ingress(namespace=namespace) raises 404 error instead of empty list
What happened (please include outputs or screenshots):
The call to method list_namespaced_ingress()
of NetworkingV1Api
is raising 404 error.
What you expected to happen:
It should return an empty list, as other list
methods do (e.g. list_namespaced_config_map
, list_namespaced_deployment
, list_namespaced_horizontal_pod_autoscaler
, etc)
How to reproduce it (as minimally and precisely as possible):
Call NetworkingV1Api().list_namespaced_ingress(namespace=...)
for a namespace that doesn't have ingresses. In my case, it was the default
namespace.
Anything else we need to know?: Running inside GitHub Actions.
Environment:
- Kubernetes version (
kubectl version
): - - OS (e.g., MacOS 10.13.6): Ubuntu 20.04
- Python version (
python --version
): 3.10.2 - Python client version (
pip list | grep kubernetes
): 21.7.0
Hi @ckkz-it , please try this script and it's working in my cluster.
from kubernetes import client, config
def main():
config.load_kube_config()
net_api = client.NetworkingV1Api()
print(net_api.list_namespaced_ingress("default"))
if __name__ == "__main__":
main()
Hi @showjason, thanks for the answer.
Looks like this occurs sometimes even if we have ingresses in the default namespace, but I don't have exact steps for reproducing the issue. I'll try to update once we will have more info.
cc @roycaihw
Thanks @showjason @ckkz-it. Yes please let us know when you have more info.
i try this script but this error
kubernetes.client.exceptions.ApiException: (404) Reason: Not Found HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Date': 'Thu, 07 Apr 2022 03:04:39 GMT', 'Content-Length': '174'}) HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"the server could not find the requested resource","reason":"NotFound","details":{},"code":404}
kubernetes 版本和 kubernetes-client 版本不匹配,换成匹配的版本可以解决问题。
client 9.y.z: Kubernetes 1.12 or below (+-), Kubernetes 1.13 (✓), Kubernetes 1.14 or above (+-) client 10.y.z: Kubernetes 1.13 or below (+-), Kubernetes 1.14 (✓), Kubernetes 1.14 or above (+-) client 11.y.z: Kubernetes 1.14 or below (+-), Kubernetes 1.15 (✓), Kubernetes 1.16 or above (+-) client 12.y.z: Kubernetes 1.15 or below (+-), Kubernetes 1.16 (✓), Kubernetes 1.17 or above (+-) client 17.y.z: Kubernetes 1.16 or below (+-), Kubernetes 1.17 (✓), Kubernetes 1.18 or above (+-) client 18.y.z: Kubernetes 1.17 or below (+-), Kubernetes 1.18 (✓), Kubernetes 1.19 or above (+-) client 19.y.z: Kubernetes 1.18 or below (+-), Kubernetes 1.19 (✓), Kubernetes 1.20 or above (+-) client 20.y.z: Kubernetes 1.19 or below (+-), Kubernetes 1.20 (✓), Kubernetes 1.21 or above (+-) client 21.y.z: Kubernetes 1.20 or below (+-), Kubernetes 1.21 (✓), Kubernetes 1.22 or above (+-) client 22.y.z: Kubernetes 1.21 or below (+-), Kubernetes 1.22 (✓), Kubernetes 1.23 or above (+-) client 23.y.z: Kubernetes 1.22 or below (+-), Kubernetes 1.23 (✓), Kubernetes 1.24 or above (+-)
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:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale
- Mark this issue or PR as rotten with
/lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Reopen this issue with
/reopen
- Mark this issue as fresh with
/remove-lifecycle rotten
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied- After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied- After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closedYou can:
- Reopen this issue with
/reopen
- Mark this issue as fresh with
/remove-lifecycle rotten
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.