Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubernetes.client.rest.ApiException: (404) error #360

Open
QAInsights opened this issue Jun 23, 2022 · 6 comments
Open

kubernetes.client.rest.ApiException: (404) error #360

QAInsights opened this issue Jun 23, 2022 · 6 comments

Comments

@QAInsights
Copy link

QAInsights commented Jun 23, 2022

I installed powerfulseal in WSL (and also tried on Mac with AWS EKS) and tried injecting failure to my local k8s cluster. The autonomous mode is failing with 404. But the interactive mode is working fine.

Could someone check this issue please?

2822 ± powerfulseal autonomous --policy-file policy.yaml                                                                                                                                ⏎ ✭
2022-06-22 21:04:32 INFO __main__ verbosity: None; log level: INFO; handler level: INFO
2022-06-22 21:04:32 INFO __main__ Creating kubernetes client with config /home/naveenkumar/.kube/config (path found for backwards compatibility)
2022-06-22 21:04:32 INFO k8s_client Initializing with config: /home/naveenkumar/.kube/config
2022-06-22 21:04:32 INFO __main__ No cloud driver - some functionality disabled
2022-06-22 21:04:32 INFO __main__ Using stdout metrics collector
2022-06-22 21:04:32 INFO __main__ Starting the UI server (0.0.0.0:8000)
2022-06-22 21:04:32 INFO __main__ STARTING AUTONOMOUS MODE
2022-06-22 21:04:32 ERROR k8s_client (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'a6598636-571f-4085-a456-46a527cd7d12', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': 'de5a8de5-c26f-4a03-bad4-2288cac06f7c', 'X-Kubernetes-Pf-Prioritylevel-Uid': 'f1fad1c5-8779-42d7-a8ba-58fb8735b7a9', 'Date': 'Thu, 23 Jun 2022 01:04:32 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}


Traceback (most recent call last):
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/powerfulseal/k8s/k8s_client.py", line 200, in get_scenarios
    crds = self.client_extensionsApi.list_custom_resource_definition().to_dict()['items']
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/api/apiextensions_v1beta1_api.py", line 522, in list_custom_resource_definition
    (data) = self.list_custom_resource_definition_with_http_info(**kwargs)  # noqa: E501
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/api/apiextensions_v1beta1_api.py", line 603, in list_custom_resource_definition_with_http_info
    return self.api_client.call_api(
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 340, in call_api
    return self.__call_api(resource_path, method,
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 172, in __call_api
    response_data = self.request(
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 362, in request
    return self.rest_client.GET(url,
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 237, in GET
    return self.request("GET", url,
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 231, in request
    raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'a6598636-571f-4085-a456-46a527cd7d12', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': 'de5a8de5-c26f-4a03-bad4-2288cac06f7c', 'X-Kubernetes-Pf-Prioritylevel-Uid': 'f1fad1c5-8779-42d7-a8ba-58fb8735b7a9', 'Date': 'Thu, 23 Jun 2022 01:04:32 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}


Traceback (most recent call last):
  File "/home/naveenkumar/.local/bin/powerfulseal", line 8, in <module>
    sys.exit(start())
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/powerfulseal/cli/__main__.py", line 656, in start
    main(sys.argv[1:])
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/powerfulseal/cli/__main__.py", line 625, in main
    success = runner.run(
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/powerfulseal/policy/policy_runner.py", line 86, in run
    policy = self.read_policy()
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/powerfulseal/policy/policy_runner.py", line 52, in read_policy
    scenarios = self.k8s_client.get_scenarios()
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/powerfulseal/k8s/k8s_client.py", line 200, in get_scenarios
    crds = self.client_extensionsApi.list_custom_resource_definition().to_dict()['items']
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/api/apiextensions_v1beta1_api.py", line 522, in list_custom_resource_definition
    (data) = self.list_custom_resource_definition_with_http_info(**kwargs)  # noqa: E501
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/api/apiextensions_v1beta1_api.py", line 603, in list_custom_resource_definition_with_http_info
    return self.api_client.call_api(
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 340, in call_api
    return self.__call_api(resource_path, method,
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 172, in __call_api
    response_data = self.request(
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 362, in request
    return self.rest_client.GET(url,
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 237, in GET
    return self.request("GET", url,
  File "/home/naveenkumar/.local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 231, in request
    raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'a6598636-571f-4085-a456-46a527cd7d12', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': 'de5a8de5-c26f-4a03-bad4-2288cac06f7c', 'X-Kubernetes-Pf-Prioritylevel-Uid': 'f1fad1c5-8779-42d7-a8ba-58fb8735b7a9', 'Date': 'Thu, 23 Jun 2022 01:04:32 GMT', 'Content-Length': '174'})
@seeker89
Copy link
Contributor

It looks like your version of k8s deprecated the apiextensions_v1beta1_api used in list_custom_resource_definition.

I think we'll probably need to move onto v1 api.

What version of k8s are you running?

@QAInsights
Copy link
Author

@seeker89 I am running 1.23.5 in Rancher, also tried with 1.22.8 in Digital Ocean and in 1.22.6 in AWS EKS.

@seeker89
Copy link
Contributor

Right, that adds up. We'll need to bump up the k8s lib version #358 and then change the function from the beta to non-beta version.

Would you like to give it a spin?

@QAInsights
Copy link
Author

Sure. I would love to :) @seeker89

@QAInsights
Copy link
Author

@seeker89 When will the next version get released :) ?

@jcstanaway
Copy link
Contributor

There was a PR from July 2021 to fix this. #345

While the repo has tagged 3.2.0 and 3.3.0 releases, no docker image has been published since 3.1.0.

The last commit to master was October 2021.

Is this project effectively dead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants