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

            How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

            Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?