Skip to main content

Configure your Okteto Pipeline

Automatic Deployment

When you deploy a Git repository, Okteto Cloud will analyze the source code of your Git repository looking for clues on how to deploy your application.

Okteto will look for deployment manifests in the following order:

  1. Helm Chart: if your repository has a chart, charts, helm/chart, or helm/charts directory with a Chart.yaml file in it, Okteto will detect the chart and run helm upgrade --install on it.
  2. Kubernetes manifests folder: if your repository has a manifests, kubernetes, or k8s folder, Okteto will detect it and run kubectl apply on the folder.
  3. Kubernetes manifests file: if your repository has a manifests.yaml, kubernetes.yaml, or k8s.yaml file, Okteto will detect it and run kubectl apply on the manifest file.
  4. Okteto Stacks file: if your repository has a okteto-stack.yaml file, Okteto will detect it and run okteto stack deploy --build on this file.
  5. Docker-compose file: if your repository has a docker-compose.yaml, Okteto will detect it and run okteto stack deploy --build on this file.
  6. Okteto Manifest file: if your repository has an okteto.yml or .okteto/okteto.yml file, Okteto will detect it and run okteto push on the manifest file.

Customize the Okteto Pipeline

If Okteto is not able to detect how to deploy your application, or you want to have more control over it, you can customize the Okteto Pipeline by adding a okteto-pipeline.yml or .okteto/okteto-pipeline.yml file to the root of your repository.

Example okteto-pipeline.yml

- okteto build -t${OKTETO_GIT_COMMIT} api
- okteto build -t${OKTETO_GIT_COMMIT} frontend
- helm upgrade --install movies chart --set tag=${OKTETO_GIT_COMMIT}
- api/okteto.yml
- frontend/okteto.yml

Schema Reference

  • icon: the icon associated to your application in the Okteto Cloud Dashboard (optional).
  • deploy: list of commands to deploy your application in your Kubernetes namespace. It is usually a combination of helm, kubectl, and okteto commands.
  • destroy: list of commands to be executed when the pipeline is destroyed. It can be used to release any resource created outside Okteto.
  • devs: the paths to the okteto manifests in your Git repository. This is used to fill the hints in the Develop dialog of each service (optional).

For example, the above example builds fresh docker images for the api and frontend components of the Movies App, pushes these images to the Okteto Registry and deploys the app with Helm.

Built-in tools

Okteto will run an installation job that clones your Git repository, checks out the selected branch, and executes the sequence of deploy commands. The job will fail if any of the commands in the deploy list fails.

The installation job will run in an Alpine Linux container with the following tools preinstalled:

  • bash
  • cue
  • curl
  • envsubst
  • git
  • helm
  • kubectl
  • kustomize
  • make
  • okteto
  • openssh
  • wait-for-it

The installation job container is automatically configured with credentials to use the above tools on the namespace where your application is deployed.

Are we missing any binaries you use? File an issue here and we will do our best to make it available.

Built-in Environment Variables

The installation job also populates the following environment variables. You can refer to this in your deploy commands if needed:

  • OKTETO_NAMESPACE: the namespace where your application is going to be installed.
  • OKTETO_GIT_BRANCH: the name of the Git branch currently being deployed.
  • OKTETO_GIT_COMMIT: the SHA1 hash of the last commit of the branch.
  • OKTETO_REGISTRY_URL: the url of the Okteto Registry.
  • BUILDKIT_HOST: the address of the Okteto Cloud buildkit instance. You can use it to build your images with any CLI tool that supports Buildkit builds.