Bug 1344877
Summary: | The --api-prefix option of oc proxy gives not correct example | ||
---|---|---|---|
Product: | OKD | Reporter: | Xingxing Xia <xxia> |
Component: | oc | Assignee: | Fabiano Franz <ffranz> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Xingxing Xia <xxia> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 3.x | CC: | aos-bugs, mmccomas |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2016-09-19 13:49:20 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Xingxing Xia
2016-06-12 05:34:03 UTC
I can reproduce it on latest kubernetes code base. I did some investigation and I found that it is working as expected. The correct way to curl is : curl -H "Authorization: Bearer <token>" 127.0.0.1:8011/k8s-api/api/v1/namespaces/xxia-proj/pods/ Please note this is: 127.0.0.1:8011/k8s-api/api/v1/... not 127.0.0.1:8011/k8s-api/v1/ k8s-api is not a substitute for api, it is a prefix for /api/... . And this is evident from kubectl proxy --help: To proxy the entire kubernetes api at a different root, use: kubectl proxy --api-prefix=/custom/ The above lets you 'curl localhost:8001/custom/api/v1/pods I am closing this as not a bug. Thanks! `kubectl proxy --help` examples are more detailed, clearer and updated (its example uses .../v1/... rather than .../v1beta3/...). It is good tips to understand oc usage by examining kubectl help info. BTW, `oc proxy -h` says "localhost:8011/k8s-api/v1beta3/pods/" and "--api-prefix=k8s-api". This is not correct too. We must give "/", like "--api-prefix=/k8s-api" (the 2nd '/' is optional, that is, "--api-prefix=/k8s-api/" is also ok). See the comparison: Test 1: oc proxy --port=8011 --api-prefix=k8s-api # No the 1st '/' Starting to serve on 127.0.0.1:8011 On another terminal: curl -H "Authorization: Bearer <token>" 127.0.0.1:8011/k8s-api/api/v1/namespaces/xxia-proj/pods/ 404 page not found curl -H "Authorization: Bearer <token>" 127.0.0.1:8011/k8s-api/api/v1/pods/ 404 page not found Test 2: oc proxy --port=8011 --api-prefix=/k8s-api # Give the 1st '/' Starting to serve on 127.0.0.1:8011 On another terminal: curl -H "Authorization: Bearer <token>" 127.0.0.1:8011/k8s-api/api/v1/namespaces/xxia-proj/pods/ # Succeed and return json content of pods curl -H "Authorization: Bearer <token>" 127.0.0.1:8011/k8s-api/api/v1/pods/ # Succeed and return json content of pods in all namespaces (if the <token> belongs to a cluster-admin user) So I'd like to convert the bug to CLI help info bug. CLI help fixed in https://github.com/openshift/origin/pull/9493. Verified with: oc v1.3.0-alpha.2-164-g24dcd13 kubernetes v1.3.0-alpha.3-599-g2746284 |