A service is a set of containers running the same container image.
Below is an example of a
Each key is documented below:
The name of the service. Every service on the same project will be able to ping this service using its name.
Service names should be unique per project.
Service names only accept alphanumeric characters and dashes.
The number of instances running this service (default:
It is the set of volumes for this service.
Each volume might have the following keys:
Indicates if the volume must be created persistent (default:
Indicates the size of the volume (default:
It is the set of containers running this service.
The most common case is to have a single container, but there are other use cases where more than a single container is needed (what it is also known as Pods).
Each container might have the following keys:
The image used to deploy this container. This is the only mandatory key.
A list of environment variables to add in the container at launch. They are represented using an array format.
If your project has any
secrets declared, you can use them instead of the value, and okteto will replace it during deployment time:
Overrides the default command in the container image.
command: echo 'Hello Okteto!'
Overrides the default args in the container image.
Overrides the default working dir in the container image.
Defines the public ports that are accessible from the internet. If the project has configured an ingress controller, ports are exposed using ingress rules. If not, a load balancer is created.
Defines the private ports that are accessible from inside the cluster.
Defines the ingress rules to access this container (only available in projects configured with an ingress controller).
This would create an ingress rule for the host
api and the path
/api/v1 to redirect to port 8000 in this container.
Specifies the resources that a container can consume. It maps the same behaviour than kubernetes resources. For more information, go to the kubernetes documentation.
Specifies the runtime for activating the dev mode in this container.
It is the docker image to use (the default is the same defined for the container).
Redefine the command of the dev container image.
Redefine the command arguments of the dev container image.
Indicates where to synchronize your local source code into the dev container (default: