okteto.yml is a manifest format for describing development environments. It declares the deployment target, the dev container, the working directory and other information required to activate your development environment with okteto.
The name of your development environment. If
labels is not defined, it is also the name of the kubernetes deployment you want to transform into a development environment.
The labels of the kubernetes deployment you want to transform into a development environment. They must identify a single kubernetes deployment.
The name of the container in your deployment you want to transform into a development environment. By default, it takes the first one.
The namespace of the deployment you want to transform into a development environment. By default, it takes the current kube config namespace.
Sets the container image of your development environment. Defaults to the image specified in your deployment.
Sets the command of your development environment. By default, it creates an
Sets the working directory of your development environment.
mountpath is not specified,
workdir also specifies the mount path of your local folder in your development environment.
Sets the mount path of your local folder in your development environment (default:
Sets a relative subpath of your local folder to mount in your development environment, instead of mounting the root of your local folder.
A list of environment variables that will be injected into your development environment. If a variable already exists on your deployment, it will be overridden with the value specified on the manifest.
Environment variables with only a key, or with a value that starts with a
$ sign are resolved to their values on the machine okteto is running on, which can be helpful for secret or machine-specific values.
A list of paths in your development environment that you want to associate to persistent volumes. This is useful to persist information between
okteto up executions, like downloaded libreries or cache information. For example, to speed your golang builds up, you could define:
Allows you to override the resources configuration of your development environment. It supports the same syntax used in Kubernetes. By default,
limits are unset.
A list of ports to forward from your development environment. The list should follow the
localPort:remotePort notation and each element should be unique.
Once your development environment is up and running, you will be able to access the port directly by using
Common uses of port forwarding are:
- Access a service via
localhostinstead of via an ingress
- Get direct access to a service that’s not exposed via a service (e.g. a queue consumer)
- Connect to a hot reloader via a websocket
- Remote debugging
If Okteto can’t forward a port (typically because they are already taken), an error will be logged in the console.
A list of other containers (other than the main one) that you want to put in developer mode. The difference with the main container and the ones defined in this section is that the main container is transformed into an interactive session, where you can, for example, execute a shell. The containers defined in this section run in detached mode, but they can also mount your local folder in a particular path.
For example, to put a Django application in developer mode you could use the following manifest:
and both deployments,
worker will mount your local folder into the path
The supported keys for containers defined in this section are:
They work the same as for the main container, except for the
name keys. For
command defaults to the command specified in your deployment, instead of
name are mutually exclusive (for the main container,
name is mandatory).