-
Notifications
You must be signed in to change notification settings - Fork 167
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
Request K8s API, But it return bad-request (400) #418
Comments
Off the top of my head: Rancher puts API at a sub-path ( |
BTW, for |
Obligatory warning about |
@YouRNotPaulChan can you post output of |
Thank you for your reply, but the situation I encountered only happened in the POST method, and everything was normal when using the GET method |
Thanks again, I am on vacation now, but that Kubernetes is deployed in my company's Intranet, I will post the instance variable of client next Monday:) |
@cben This is the output with "==============client============="
#<Kubeclient::Client:0x00007ff6312e1ba0
@api_endpoint=#<URI::HTTPS https://MY_HOST/k8s/clusters/c-h4mdn/api>,
@api_group="clusters/",
@api_version="v1",
@as=:ros,
@auth_options=
{:bearer_token=>
"my_token"},
@discovered=false,
@entities={},
@headers=
{:Authorization=>
"my_token"},
@http_max_redirects=10,
@http_proxy_uri=nil,
@socket_options={:socket_class=>nil, :ssl_socket_class=>nil},
@ssl_options=
{:cert_store=>
#<OpenSSL::X509::Store:0x00007ff6312e2050
@chain=nil,
@error=nil,
@error_string=nil,
@time=nil,
@verify_callback=nil>,
:verify_ssl=>0},
@timeouts={:open=>60, :read=>60}>
"==============client=============" |
Have you solved this problem?I have the same question with you. |
I have the same question and when I DELETE a entity , I got the Uncaught exception: HTTP status code 404, the server could not find the requested resource for DELETE https://{my_host}/k8s/clusters/c-h4mdn/api/v1/pods/nginx-test.WHY? Here is my code: deleted = client.delete_pod("nginx-test") |
[Sorry for silence, frantic time at work and home... BTW, I'd be happy to add more maintainers to kubeclient if anyone is interested.]
|
Thanks for your reply! I have tried many times and found that api 'https://{my_host}/k8s/clusters/c-h4mdn/api' can only GET method not POST ,PUT and DELETE methods.After I change my api into "https://MY_HOST:6443" ,everything be OK.But I don't konw why ,maybe which is related to configuration inside k8s. |
@Go-Macyun No, it's not k8s's fault, it's kubeclient's — it's quite clearly #318. Can you try my branch from #333? |
`handle_uri` expected the Kubernetes API to be rooted at `/` if more than 2 components were included in the provided URL. This was done to extract a potential `api_group` from the URL. This commit changes that behaviour, to parse that `api_group` via a regex, rather than leaning on a strict URL pattern. This commit also takes into account, that OpenShift uses `/oapi`, as well as including a test-suite for that new API URL handling. Implements ManageIQ#318 Fixes ManageIQ#418
`handle_uri` expected the Kubernetes API to be rooted at `/` if more than 2 components were included in the provided URL. This was done to extract a potential `api_group` from the URL. This commit changes that behaviour, to parse that `api_group` via a regex, rather than leaning on a strict URL pattern. This commit also takes into account, that OpenShift uses `/oapi`, as well as including a test-suite for that new API URL handling. Tests also include checks for the `@api_group` and `@api_version` instance variables and a non-default version. Implements ManageIQ#318 Fixes ManageIQ#418
`handle_uri` expected the Kubernetes API to be rooted at `/` if more than 2 components were included in the provided URL. This was done to extract a potential `api_group` from the URL. This commit changes that behaviour, to parse that `api_group` via a regex, rather than leaning on a strict URL pattern. This commit also takes into account, that OpenShift uses `/oapi`, as well as including a test-suite for that new API URL handling. Tests also include checks for the `@api_group` and `@api_version` instance variables and a non-default version. Implements ManageIQ#318 Fixes ManageIQ#418
`handle_uri` expected the Kubernetes API to be rooted at `/` if more than 2 components were included in the provided URL. This was done to extract a potential `api_group` from the URL. This commit changes that behaviour, to parse that `api_group` via a regex, rather than leaning on a strict URL pattern. This commit also takes into account, that OpenShift uses `/oapi`, as well as including a test-suite for that new API URL handling. Tests also include checks for the `@api_group` and `@api_version` instance variables and a non-default version. Implements ManageIQ#318 Fixes ManageIQ#418
versions
My code:
The contents of
config.kubeconfig
:The contents of
nginx.yaml
:The error I'm getting is this, and I think it maybe the
apiVersion
is wrong:The text was updated successfully, but these errors were encountered: