Okteto context management¶
In the Okteto CLI, the context refers to the specific Kubernetes cluster and namespace configuration that the tool is currently targeting. It allows developers to switch between different environments, such as local clusters or remote Okteto Cloud instances, similar to how kubectl manages context.^[400-devops__01-Concepts-of-Software-Development__okteto.md]
Key commands¶
The primary command for managing these settings is okteto context, which allows users to set or view the default target for their operations^[400-devops__01-Concepts-of-Software-Development__okteto.md].
To switch the active context to the Okteto Cloud, users can run:
okteto context use https://cloud.okteto.com^[400-devops__01-Concepts-of-Software-Development__okteto.md]
If authentication is required, a token can be included directly in the command:
okteto context use https://cloud.okteto.com --token $YOUR_TOKEN^[400-devops__01-Concepts-of-Software-Development__okteto.md]
To view all available or current contexts, the list command is used:
okteto context list^[400-devops__01-Concepts-of-Software-Development__okteto.md]
Kubernetes integration¶
Once a context is selected, the Okteto CLI can download the necessary Kubernetes credentials for that specific cluster using the kubeconfig command^[400-devops__01-Concepts-of-Software-Development__okteto.md]. This bridges the gap between the Okteto context and standard Kubernetes tooling.
Additionally, users can manage the specific namespace within the chosen context using the okteto namespace command^[400-devops__01-Concepts-of-Software-Development__okteto.md].
Sources¶
^[400-devops__01-Concepts-of-Software-Development__okteto.md]