Stacks are designed for developers who don't want to deal with the complexities of Kubernetes manifests. Define your application using a docker-compose like format.
name: voting-appservices:vote:public: trueimage: okteto/vote:stacksbuild: votereplicas: 2ports:- 8080resources:cpu: 100mmemory: 128Miredis:image: redisports:- 6379resources:cpu: 100mmemory: 128Mistorage: 1Givolumes:- /data
The equivalent Kubernetes manifests would have more than 200 lines of yaml!
name (string, required)
The name of your Stack.
namespace (string, optional)
The namespace where you want to deploy your Stacks. By default, it takes the current kube config namespace.
services ([object], optional)
Define the services that make up your application so they can be run together when the Stack is deployed.
Each service has the following properties:
build ([string|object], optional)
Indicate that the image of this service must be built when running
okteto stack deploy --build. The value caan be the path to the build context:
or an object that supports these fields:
context: the build context that is sent to BuildKit. When the value supplied is a relative path, it is interpreted as relative to the location of the stack manifest file (default:
dockerfile: the path to the Dockerfile. It is a relative path to the build context (default:
target: build the specified stage as defined inside the Dockerfile. See the multi-stage build Docker official docs for details.
args: add build arguments, which are environment variables accessible only during the build process. Build arguments with a value containing a
$sign are resolved to the environment variable value on the machine okteto is running on, which can be helpful for secret or machine-specific values.
...push:context: .dockerfile: Dockerfiletarget: prodargs:- ENV1=prod- ENV2=$VALUE...
okteto stack deploy --build builds a new docker image, pushes it to the registry and redeploys your containers. By default, images are built using the Okteto Build Service. Set the variable
BUILDKIT_HOST if you want to use your own BuildKit instance.
command (string, optional)
Override the default image command.
command: bundle exec thin -p 3000
The command can also be a list of string:
command: ["bundle", "exec", "thin", "-p", "3000"]
environment ([string], required)
Add environment variables. Specify them as an array of strings:
environment:- DEV_MODE=yes- DB_HOST=$HOST
image (string, required)
The container image of each service.
ports ([int], optional)
Ports exposed by each service. By default, they are only accessible from the cluster private network.
public (bool, optional)
If the service should be exposed via a public endpoint or not (default:
replicas (bool, optional)
Specify the number of containers that should be running for each service (default:
resources (object, optional)
Configures resource constraints. For example, to configure a service with 300 mili cpus, 500Mi of memory and 5Gi of storage:
resources:cpu: 300mmemory: 500Mistorage: 5Gi
Specify how long to wait (in seconds) when attempting to stop a container before sending SIGKILL
volumes ([string], optional)
List of persistent volumes mounted on the containers of each service.