Download your Kubernetes credentials
This section explains how to download your Kubernetes credentials and start developing your applications in Okteto with your favorite CLI tools.
The first thing you need to do is install the Okteto CLI and ensure the executable is in your PATH. This is needed because the kubeconfig provided by Okteto uses a credential plugin to authenticate access your Kubernetes cluster. It is a common pattern used by many Kubernetes providers, such as Google Kubernetes Engine (GKE), Azure Kubernetes Service (AKS), or Amazon Elastic Kubernetes Service (EKS) to connect to Kubernetes clusters.
If this is your first time using the Okteto CLI, install it following this guide. After completing those steps, the Okteto CLI should be in your PATH.
The next thing you need to do is to configure your Okteto context to point to your Okteto instance. To do this, run the okteto context
command:
$ okteto context use https://okteto.example.com
Authentication will continue in your default browser
✓ Context 'okteto.example.com' created
If you're not logged into Okteto yet, it will also run the login sequence.
Now that you have installed Okteto CLI and it is connected to your Okteto instance, you can download the Kubernetes credentials. There are two different ways of doing so:
-
Download your Kubernetes credentials using the Okteto CLI.
-
Download your Kubernetes credentials from the Okteto dashboard.
Download your Kubernetes credentials using the Okteto CLI
Having your Okteto context configured to access Okteto, run the following command:
$ okteto kubeconfig
Updated kubernetes context 'okteto_example_com/cindy' in '/Users/cindy/.kube/config'
The okteto kubeconfig
command adds your Kubernetes credentials to your kubeconfig file, and sets it as the current Kubernetes context.
Once you do this, you'll have full access to your Kubernetes namespace with kubectl
, helm
or any other CLI tool.
Download your Kubernetes credentials from the Okteto dashboard
From the Okteto dashboard you should also find your credentials in the Settings > Setup
section.
Once downloaded, point your KUBECONFIG
environment variable to the credentials file:
- MacOS / Linux
- Windows
$ export KUBECONFIG=$HOME/Downloads/okteto-kube.config:${KUBECONFIG:-$HOME/.kube/config}
> $Env:KUBECONFIG=("$HOME\Downloads\okteto-kube.config;$Env:KUBECONFIG;$HOME\.kube\config")
To see that the new configuration is working, enter this command:
$ kubectl get all
No resources found.