Okteto Manifest Overview
The Okteto Manifest is how you configure the behavior for building, deploying, and developing your application in Okteto. These are the main sections of the Okteto Manifest:
Section | Description |
---|---|
build | Configure a list of images to build for your application |
deploy | Configure a list of commands to deploy your application. You can also refer to Docker Compose files |
dependencies | Configure a list of git repositories to deploy as part of your application |
destroy | Configure a list of commands to destroy your application |
dev | Configure a list of Development Containers to define how okteto up works when you are iterating on your application |
external | Configure a list of External Resources that exist outside of the Kubernetes cluster (e.g. cloud resources, dashboards). |
There are other sections to help you build your ideal development experience in Okteto, but this document focuses solely on introducing you to the core concepts of the Okteto Manifest. You can learn more about the other Okteto Manifest options in the manifest reference.
Build
This section contains the instructions for Okteto to build the images for each service of your application.
Your build
section might look like this:
build:
api:
context: api
frontend:
context: frontend
dockerfile: Dockerfile
secrets:
npmrc: .npmrc
This configuration defines images to be built for three services: api
, and frontend
. It also defines a context
for each image, which tells Okteto which folder/subfolder to use for building each container image.
In this case, Okteto is using the api
subfolder for the api
image, and the frontend
subfolder for the frontend
image. For the frontend
image, it's also defining the dockerfile
path and a build secret.
Refer to our documention to learn more about the build
section and how Okteto Build works.
Deploy
This section tells Okteto how to deploy your application. It typically uses a combination of helm
, kubectl
, and okteto
commands.
All the resources created by these commands will appear in the Okteto UI as part of a single Development Environment that represents the whole of your application.
If you have external resources you'd like to configure and show within the Okteto development environment, you must configure those in the external section.
Your deploy
section might look like this:
deploy:
- name: Deploy PostgreSQL
command: helm upgrade --install postgresql postgresql/postgresql-11.6.21.tgz -f postgresql/values.yml --version 11.6.21
- name: Deploy Frontend
command: helm upgrade --install frontend frontend/chart --set image=${OKTETO_BUILD_FRONTEND_IMAGE}
- name: Deploy API
command: helm upgrade --install api api/chart --set image=${OKTETO_BUILD_API_IMAGE} --set load=${API_LOAD_DATA:-true}
In this sample the deploy
section instructs Okteto to execute three commands: deploy a postgresql database, deploy the frontend
helm chart (referring the frontend
image using an environment variable), and deploy the api
chart (referring the api
image using an environment variables).
Refer to our documention to learn more about the deploy
section.
Okteto recommends that you enable Remote Execution for your deploy commands
Dependencies
This section tells Okteto to deploy a list of git repositories as part of the deployment of your application.
Your dependencies
section might look like this:
dependencies:
mongodb:
repository: https://github.com/okteto/mongodb
wait: true
In this sample the dependencies
section instructs Okteto to deploy the repo https://github.com/okteto/mongodb and wait until its resources are available before running the commands in the deploy
section of the Okteto Manifest.
You can learn more about the dependencies
section here.
Dev
This section contains a list of Development Containers that determine how the Okteto CLI and, specifically, the okteto up
command behave. This section is how Okteto hot reloads and debug the code between your local computer and your Development Environment.
Your dev
section might look like this:
dev:
api:
command: ["bash"]
forward:
- 8080:8080
- 9229:9229
sync:
- api:/usr/src/app
frontend:
command: yarn start
sync:
- frontend:/usr/src/app
In this sample, the api
section will tell Okteto to create a Development Container that exists specifically to sync code between your local computer and the api Kubernetes Deployment so you can see your changes in real-time within your Development Environment.
You can learn more about the dev
section here.
External
This section contains a list of resources external to the Kubernetes cluster such as cloud resources or dashboards, but that are part of your application. Configuring your external resources enables you to build a more complete development experience in Okteto.
Your external
section might look like this:
external:
readme:
icon: okteto
notes: README.md
endpoints:
- name: Try it out!
url: https://github.com/okteto/voting-app-with-external-resources
lambda:
icon: aws
notes: docs/lambda.md
endpoints:
- name: function
This section provides only the metadata to represent and link to external resources in the Okteto UI and does not create any resources in a cloud provider. Creating or destroying the resources themselves is done in the deploy and destroy sections, respectively.
You can learn more about the external
section here.
Destroy
This section tells Okteto how to destroy your application.
The Okteto CLI command okteto destroy
will automatically destroy any Kubernetes resources created by the okteto deploy
command.
The commands you define in the destroy
section will ensure any resources external to the Kubernetes cluster are destroyed when destroying the Development Environment.
Your destroy
section might look like this:
destroy:
image: okteto/pipeline-runner:1.0.0-sam
commands:
- name: destroy worker service
command: |
sam delete --no-prompts --stack-name "${OKTETO_NAMESPACE}-voting-texkhnclxd" --region us-east-1
In this sample the destroy
section instructs Okteto to delete the worker service running in AWS.
When the application is deleted, Okteto will execute this command ensuring orphaned resources don't remain active.
You can learn more about the destroy
section here.
Okteto recommends that you enable Remote Execution for your destroy commands