Skip to main content
Version: 1.28

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

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:

$ export KUBECONFIG=$HOME/Downloads/okteto-kube.config:${KUBECONFIG:-$HOME/.kube/config}

To see that the new configuration is working, enter this command:

$ kubectl get all
No resources found.

Using your Kubernetes credentials

Once you've downloaded your credentials, you'll have full access to your Kubernetes namespaces on Okteto directly from your terminal, using the tools you're already familiar with, such as helm, kubectl, okteto or skaffold.

For example, you could use kubectl to deploy our hello-world application:

kubectl apply -f https://raw.githubusercontent.com/okteto/go-getting-started/master/k8s.yml

Credential plugins are a way of managing Kubernetes cluster credentials in a more secure way as you get time-bound tokens for your service account instead of using auto-generated secret-based ones. If you prefer to use static, auto-generated tokens you can do so by setting the environment variable OKTETO_USE_STATIC_KUBETOKEN to true before running any Okteto command. Be aware that using static tokens is not recommended by Kubernetes and you will receive warnings in your kubectl output from version 1.27 onward encouraging you to stop using them.