How to access the kubernetes REST API

Hello,

I’m new to the octeto and kubernetes. I decided to run a test launch, to get into it. So I used basic instruction to run default app “movies”. Now I want to understand how can I get the access to kubernetes REST API? And how can I set a specialized flag --token-auth-file=SOMEFILE on kubernetes start to be able o use bear-token auth? (I’ve downloaded kubernetes config file and found? that server address is 146.148.56.200:443 in clusters->cluster->service field. Is this address provider the access i need?)

Hi @andahay, welcome to our community!

To call the Kubernetes REST API you need the following values:

  • The Kubernetes Server Address (the one on clusters->cluster->service)
  • The User token of your Okteto account ( users → user → token)

With those two values, you’ll be able to query the Kubernetes API. Keep in mind that in Okteto, your API access is limited to your namespace, so you won’t be able to use APIs that call cluster-wide resources.

1 Like

Thanks a lot for your answer!
Can you, please, make one more thing clear to me: is there any ability to get the access to API cluster-wide calls? (for example to endpoint http://host:port/api/v1/componentstatuse - now it is forbiden). Maybe some commands for role binding (to make user a cluster-master for example) in terminal or edits in config files?
My task is to make an app for kubernetes cluster monitoring (resources, networks and so on) and I decided to use octeto for quick start of kubernetes. Was it a good choise or you can advise me some other resources?

That’s not possible on https://cloud.okteto.com (aka Okteto Cloud). Okteto Cloud is a multi-tenant system, so you only get access to APIs scoped to your namespaces.

To access cluster-level APIs, you need access to an entire Kubernetes cluster. Okteto Cloud won’t give you that. If you don’t have experience with cloud providers, I’d recommend you look at Civo or Digital Ocean. They are both developer-friendly and fairly affordable. Another option would be to run the cluster on your laptop with something like Minikube or k3s.

1 Like

Thank you very much!

1 Like