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;








0















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.










share|improve this question






















  • 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

















0















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.










share|improve this question






















  • 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













0












0








0








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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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

















  • 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












1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    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.






    share|improve this answer



























      0














      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.






      share|improve this answer

























        0












        0








        0







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 26 at 10:11









        mk_stamk_sta

        1,263228




        1,263228





























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript