Okteto Manifest

okteto.yml is a manifest format for describing cloud native development environments. It declares the deployment target, the dev container, the working directory and other information required to deploy your cloud native development environment with okteto.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
swap:
deployment:
name: vote
image: python:3
command:
- python
args:
- app.py
runAsUser: 1000
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
mount:
target: /usr/src/app
sendonly: false
environment:
- name=$USER
- environment=development
forward:
- 8080:80
- 8080:90
scripts:
run: python app.py
hello: echo Your cluster you

Schema reference

swap

Specifies the kubernetes deployment to swap and the characteristics of your development environment.

deployment

  • name (string, required): The name of the kubernetes deployment you want to target.
  • image (string, optional): The container image to use for the development environment. If missing, it defaults to the image specified on the deployment.
  • command (string, optional): Sets the command of the development environment. If specified, it should be a never ending command (default tail -f /dev/null).
  • args (string, optional): Sets the arguments of the development environment (default tail -f /dev/null).
  • runAsUser (integer, optional): The user ID the containers are run with. This value must be set if your container uses a non-root user.
  • resources (object, optional): Allows you to override the resources configuration of your Kubernetes deployment. It supports the same syntax used in Kubernetes.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
swap:
deployment:
name: vote
image: python:3
command:
- python
args:
- app.py
runAsUser: 1000
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
...

mount

Specifies the destination path for the file synchronization service.

  • target (string, optional): The destination folder in the dev container. If empty, it defaults to /usr/src/app.

We recommend that this value matches the source code location of your development environment’s Docker image. By doing this, the content of the folder will be copied from your development environment into a volume shared with the file synchronization service, speeding up the initial synchronization process.

  • sendonly (bool, optional): If true, the changes on your development environment won’t be synchronized back to your local machine. This is disabled by default.

environment

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.

1
2
3
4
5
6
...
environment:
- environment=development
- name=$USER # will be replaced by the value of $USER
- DBPASSWORD # will be given the value of $DBPASSWORD if it exists
...

In addition to the declared variables, okteto will also add an environment variable called CND_KUBERNETES_NAMESPACE, with the value of your deployment’s namespace.

forward

A list of ports to forward to your cloud native environment. The list should follow the localPort:remotePort notation and each element should be unique.

1
2
3
4
5
...
forward:
- 8080:80
- 8090:8090
...

Once your environment is up and running, you will be able to access the port directly by using localhost:localPort.

Common uses of port forwarding are:

  1. Access a service via localhost instead of via an ingress
  2. Get direct access to a service that’s not exposed via a service (e.g. a queue consumer)
  3. Connect to a hot reloader via a websocket
  4. Remote debugging

If Okteto can’t forward a port (typically because they are already taken), an error will be logged in the console.

scripts

A key-value object of the scripts that can be executed in your cloud native environment.

Each key in the scripts object is the name of the script, and it must be unique. The value is the script to be executed.

1
2
3
4
5
6
...
scripts:
build: make build
run: python app.py --debug
test: python -m test
...