Rancher 2.1: accessing kubernates API with service accounts of kubernates

Dear experts of Rancher.
I have a Rancher 2.1 (standard docker image) with a kubernates cluster inside. Then I created one kubernates namespace. Now, I want to use want to access this namespace per CURL by using API of kubernates with CURL and bearer token. I follow the advises in https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/.
But always I receive the error HTTP-401: you must authenticate.
Do you have an idea, what am I doing wrong?

Thanks a lot!
JeMo

In order to use the API you have to use your api tokens and them to the request header as Authorizaton = accesstoken:secretkey.

You can create the api key under the user profile section in the rancher UI.

Thank You alfrye very much, of course You are right! It works and now I can access API.
BR
JeMo

1 Like