Okteto CLI Reference

The Okteto Command Line Interface is a unified tool to manage your cloud native environments.

Installation information is available here.

Synopsis

1
okteto [options] <command> <subcommand> [parameters]

Use okteto command --help for information on a specific command. The synopsis for each command shows its parameters and their usage. Optional parameters are shown in square brackets.

Options

--loglevel (debug, info, warn, error).

The amount of information outputted (defaults to warn).

Available commands

analytics

Enable / Disable analytics collection. Analytics are enabled by default.

1
okteto analytics [parameters]

Options

--disable Disables analytic collection

Okteto only collects information to help us understand how our users interact with the product. We don’t collect any personally identifiable information.

When you use the okteto CLI, the following information is collected:

Please reach out to us if you have any questions or concerns about the information collected.

init

Automatically generates the okteto manifest file and a .stignore file. Okteto will scan the current folder and will generate a default manifest file based on your programming language and platform.

1
okteto init

Options

--file (string) The path to the manifest file to create (default “okteto.yml”)

down

Deactivates your cloud native development environment, stops the file synchronization service, and restores your previous deployment configuration.

1
okteto down

The down command should be run from the folder where you ran okteto up.

Options

--file (string) The path to the manifest file (default “okteto.yml”)
--namespace (string) The kubernetes namespace to use (defaults to the current kube config namespace)
--volumes Remove persistent volumes where your local folder is synched on remote.

exec

Executes the COMMAND directly in the active cloud native environment corresponding to the current folder. The command will fail if there’s no active environment.

1
okteto exec COMMAND

For more complex commands we recommend using a double dash (--) before the command parameter.

1
okteto exec -- COMMAND

The exec command should be run from the folder where you ran okteto up.

Options

--file (string) The path to the manifest file (default “okteto.yml”)
--namespace (string) The kubernetes namespace to use (defaults to the current kube config namespace)

help

Displays the full help

1
okteto help

login

Log into the Okteto service. It defaults to https://cloud.okteto.com.

1
okteto login [URL]

When you run okteto login, an account will be created for your on URL if it’s the first time you log in. The CLI will exchange an authorization token with URL, and save the information on $HOME/.okteto/.token.json.

namespace

Downloads k8s credentials for a kubernetes namespace. It defaults to your personal namespace.

1
okteto namespace [namespace]

When you run okteto namespace, okteto will download the credentials for the namespace you specified, stored them in your kubeconfig file, and set the current context to it. You need to be logged in to Okteto before running this command.

restart

Restarts your development environment pods running in detach mode. This is useful to reload configuration that cannot be hot-reloaded.

1
okteto restart

The restart command should be run from the folder where you ran okteto up.

Options

--file (string) The path to the manifest file (default “okteto.yml”)
--namespace (string) The kubernetes namespace to use (defaults to the current kube config namespace)

up

Activate your cloud native development environment

1
okteto up

When you run okteto up, okteto will swap the specified deployment with your development environment. A development environment is a copy of your existing kubernetes deployment with the following improvements:

  • The container specified on your okteto manifest (or the first one, if none is specified) will be swapped with your development container
  • Automatic file synchronization from your machine to your development environment.
  • Automatic port-forwarding
  • Errors and logs are directly displayed in your terminal window

Once your cloud native development environment is active, you can execute commands directly in your cluster with okteto exec. Run okteto down to restore your original deployment

Options

--file (string) The path to the manifest file (default “okteto.yml”)
--namespace (string) The kubernetes namespace to use (defaults to the current kube config namespace)

version

Displays the current installed version.

1
okteto version