Kubernetes REST API - Unauthorized Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Kubernetes REST APIAccess Kubernetes API using REST APIsBest Practices for securing a REST API / web serviceBest practices for API versioning?HTTP POST with URL query parameters — good idea or not?PUT vs. POST in RESTWhat exactly is RESTful programming?What's an appropriate HTTP status code to return by a REST API service for a validation failure?Understanding REST: Verbs, error codes, and authenticationHow do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?SOAP vs REST (differences)unable to access kubernetes dashboard via token
Why did Europeans not widely domesticate foxes?
What is the definining line between a helicopter and a drone a person can ride in?
Why isn't everyone flabbergasted about Bran's "gift"?
Why aren't these two solutions equivalent? Combinatorics problem
2 sample t test for sample sizes - 30,000 and 150,000
What were wait-states, and why was it only an issue for PCs?
What documents does someone with a long-term visa need to travel to another Schengen country?
Will I be more secure with my own Router behind my ISP's router?
Etymology of 見舞い
lm and glm function in R
Why did Israel vote against lifting the American embargo on Cuba?
Recursive calls to a function - why is the address of the parameter passed to it lowering with each call?
Why is ArcGIS Pro not symbolizing my entire range of values?
Why do C and C++ allow the expression (int) + 4*5?
Is Bran literally the world's memory?
Why doesn't the university give past final exams' answers?
Trying to enter the Fox's den
Does using the Inspiration rules for character defects encourage My Guy Syndrome?
Lights are flickering on and off after accidentally bumping into light switch
Can I take recommendation from someone I met at a conference?
Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?
Why are two-digit numbers in Jonathan Swift's "Gulliver's Travels" (1726) written in "German style"?
Kepler's 3rd law: ratios don't fit data
/bin/ls sorts differently than just ls
Kubernetes REST API - Unauthorized
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Kubernetes REST APIAccess Kubernetes API using REST APIsBest Practices for securing a REST API / web serviceBest practices for API versioning?HTTP POST with URL query parameters — good idea or not?PUT vs. POST in RESTWhat exactly is RESTful programming?What's an appropriate HTTP status code to return by a REST API service for a validation failure?Understanding REST: Verbs, error codes, and authenticationHow do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?SOAP vs REST (differences)unable to access kubernetes dashboard via token
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have following Kubernetes REST API request
GET https://theserver/api/v1/pods?includeUninitialized=true
and include following HTTP Headers in the request:
Authorization: Basic ***************
Accept: application/json, */*
User-Agent: kubectl.exe/v1.13.0 (windows/amd64) kubernetes/ddf47ac
Result is the following error
"kind": "Status",
"apiVersion": "v1",
"metadata": ,
"status": "Failure",
"message": "Unauthorized",
"reason": "Unauthorized",
"code": 401
I already tried the following:
- Analog kubectl request "kubectl describe pods --all-namespaces" works fine (but I need REST)
- Used "--v=12" parameter as in newkind101's comment to Kubernetes REST API to see the underlying REST API calls - looks same as mine
- Read Kubernetes Documentation - but I failed to find detail information which HTTP headers or/and HTTP body values to send to authenticate properly (few thing I could retrieve from curl sample calls in that docs)
- I read Access Kubernetes API using REST APIs but what to understand my issue before I use a framework like GoDaddy
kubectl seems to do a bit more than I can see in with the "--v=12" parameter. This bit is likely conneted to things in ".kube/config" file. Still I don't know what exactly and where to put in my HTTP request.
rest api kubernetes authorization
add a comment |
I have following Kubernetes REST API request
GET https://theserver/api/v1/pods?includeUninitialized=true
and include following HTTP Headers in the request:
Authorization: Basic ***************
Accept: application/json, */*
User-Agent: kubectl.exe/v1.13.0 (windows/amd64) kubernetes/ddf47ac
Result is the following error
"kind": "Status",
"apiVersion": "v1",
"metadata": ,
"status": "Failure",
"message": "Unauthorized",
"reason": "Unauthorized",
"code": 401
I already tried the following:
- Analog kubectl request "kubectl describe pods --all-namespaces" works fine (but I need REST)
- Used "--v=12" parameter as in newkind101's comment to Kubernetes REST API to see the underlying REST API calls - looks same as mine
- Read Kubernetes Documentation - but I failed to find detail information which HTTP headers or/and HTTP body values to send to authenticate properly (few thing I could retrieve from curl sample calls in that docs)
- I read Access Kubernetes API using REST APIs but what to understand my issue before I use a framework like GoDaddy
kubectl seems to do a bit more than I can see in with the "--v=12" parameter. This bit is likely conneted to things in ".kube/config" file. Still I don't know what exactly and where to put in my HTTP request.
rest api kubernetes authorization
How have you setup authentication for your cluster? If you want to understand the topic more -> kubernetes.io/docs/reference/access-authn-authz/authentication
– Old Schooled
Mar 22 at 16:02
Good point, thanks. I did not setup the cluster myself, I just received Url and credentials ("Basic ******") to program against. I assume Url and credentials are correct as these work with kubectl.exe from the command-line. Though, I will have this double-checked on Monday.
– Markus
Mar 23 at 11:17
Answer regarding auth setup: Yes, for the simple setup this goes out of the box via AAD integration.
– Markus
Mar 25 at 7:52
add a comment |
I have following Kubernetes REST API request
GET https://theserver/api/v1/pods?includeUninitialized=true
and include following HTTP Headers in the request:
Authorization: Basic ***************
Accept: application/json, */*
User-Agent: kubectl.exe/v1.13.0 (windows/amd64) kubernetes/ddf47ac
Result is the following error
"kind": "Status",
"apiVersion": "v1",
"metadata": ,
"status": "Failure",
"message": "Unauthorized",
"reason": "Unauthorized",
"code": 401
I already tried the following:
- Analog kubectl request "kubectl describe pods --all-namespaces" works fine (but I need REST)
- Used "--v=12" parameter as in newkind101's comment to Kubernetes REST API to see the underlying REST API calls - looks same as mine
- Read Kubernetes Documentation - but I failed to find detail information which HTTP headers or/and HTTP body values to send to authenticate properly (few thing I could retrieve from curl sample calls in that docs)
- I read Access Kubernetes API using REST APIs but what to understand my issue before I use a framework like GoDaddy
kubectl seems to do a bit more than I can see in with the "--v=12" parameter. This bit is likely conneted to things in ".kube/config" file. Still I don't know what exactly and where to put in my HTTP request.
rest api kubernetes authorization
I have following Kubernetes REST API request
GET https://theserver/api/v1/pods?includeUninitialized=true
and include following HTTP Headers in the request:
Authorization: Basic ***************
Accept: application/json, */*
User-Agent: kubectl.exe/v1.13.0 (windows/amd64) kubernetes/ddf47ac
Result is the following error
"kind": "Status",
"apiVersion": "v1",
"metadata": ,
"status": "Failure",
"message": "Unauthorized",
"reason": "Unauthorized",
"code": 401
I already tried the following:
- Analog kubectl request "kubectl describe pods --all-namespaces" works fine (but I need REST)
- Used "--v=12" parameter as in newkind101's comment to Kubernetes REST API to see the underlying REST API calls - looks same as mine
- Read Kubernetes Documentation - but I failed to find detail information which HTTP headers or/and HTTP body values to send to authenticate properly (few thing I could retrieve from curl sample calls in that docs)
- I read Access Kubernetes API using REST APIs but what to understand my issue before I use a framework like GoDaddy
kubectl seems to do a bit more than I can see in with the "--v=12" parameter. This bit is likely conneted to things in ".kube/config" file. Still I don't know what exactly and where to put in my HTTP request.
rest api kubernetes authorization
rest api kubernetes authorization
asked Mar 22 at 13:58
MarkusMarkus
33
33
How have you setup authentication for your cluster? If you want to understand the topic more -> kubernetes.io/docs/reference/access-authn-authz/authentication
– Old Schooled
Mar 22 at 16:02
Good point, thanks. I did not setup the cluster myself, I just received Url and credentials ("Basic ******") to program against. I assume Url and credentials are correct as these work with kubectl.exe from the command-line. Though, I will have this double-checked on Monday.
– Markus
Mar 23 at 11:17
Answer regarding auth setup: Yes, for the simple setup this goes out of the box via AAD integration.
– Markus
Mar 25 at 7:52
add a comment |
How have you setup authentication for your cluster? If you want to understand the topic more -> kubernetes.io/docs/reference/access-authn-authz/authentication
– Old Schooled
Mar 22 at 16:02
Good point, thanks. I did not setup the cluster myself, I just received Url and credentials ("Basic ******") to program against. I assume Url and credentials are correct as these work with kubectl.exe from the command-line. Though, I will have this double-checked on Monday.
– Markus
Mar 23 at 11:17
Answer regarding auth setup: Yes, for the simple setup this goes out of the box via AAD integration.
– Markus
Mar 25 at 7:52
How have you setup authentication for your cluster? If you want to understand the topic more -> kubernetes.io/docs/reference/access-authn-authz/authentication
– Old Schooled
Mar 22 at 16:02
How have you setup authentication for your cluster? If you want to understand the topic more -> kubernetes.io/docs/reference/access-authn-authz/authentication
– Old Schooled
Mar 22 at 16:02
Good point, thanks. I did not setup the cluster myself, I just received Url and credentials ("Basic ******") to program against. I assume Url and credentials are correct as these work with kubectl.exe from the command-line. Though, I will have this double-checked on Monday.
– Markus
Mar 23 at 11:17
Good point, thanks. I did not setup the cluster myself, I just received Url and credentials ("Basic ******") to program against. I assume Url and credentials are correct as these work with kubectl.exe from the command-line. Though, I will have this double-checked on Monday.
– Markus
Mar 23 at 11:17
Answer regarding auth setup: Yes, for the simple setup this goes out of the box via AAD integration.
– Markus
Mar 25 at 7:52
Answer regarding auth setup: Yes, for the simple setup this goes out of the box via AAD integration.
– Markus
Mar 25 at 7:52
add a comment |
1 Answer
1
active
oldest
votes
As far as I remember Basic authentication method is disabled by default and needs to be enabled by adding --basic-auth-file
flag to the API server configuration, therefore all requests to REST API are identified as anonymous user and might be resulted in 401 Unauthorized
error.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55301234%2fkubernetes-rest-api-unauthorized%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As far as I remember Basic authentication method is disabled by default and needs to be enabled by adding --basic-auth-file
flag to the API server configuration, therefore all requests to REST API are identified as anonymous user and might be resulted in 401 Unauthorized
error.
add a comment |
As far as I remember Basic authentication method is disabled by default and needs to be enabled by adding --basic-auth-file
flag to the API server configuration, therefore all requests to REST API are identified as anonymous user and might be resulted in 401 Unauthorized
error.
add a comment |
As far as I remember Basic authentication method is disabled by default and needs to be enabled by adding --basic-auth-file
flag to the API server configuration, therefore all requests to REST API are identified as anonymous user and might be resulted in 401 Unauthorized
error.
As far as I remember Basic authentication method is disabled by default and needs to be enabled by adding --basic-auth-file
flag to the API server configuration, therefore all requests to REST API are identified as anonymous user and might be resulted in 401 Unauthorized
error.
answered Mar 26 at 10:11
mk_stamk_sta
1,263228
1,263228
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55301234%2fkubernetes-rest-api-unauthorized%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How have you setup authentication for your cluster? If you want to understand the topic more -> kubernetes.io/docs/reference/access-authn-authz/authentication
– Old Schooled
Mar 22 at 16:02
Good point, thanks. I did not setup the cluster myself, I just received Url and credentials ("Basic ******") to program against. I assume Url and credentials are correct as these work with kubectl.exe from the command-line. Though, I will have this double-checked on Monday.
– Markus
Mar 23 at 11:17
Answer regarding auth setup: Yes, for the simple setup this goes out of the box via AAD integration.
– Markus
Mar 25 at 7:52