odo can be used to deploy components in a similar manner they would be deployed by a CI/CD system, by first building the images of the containers to deploy, then by deploying the Kubernetes resources necessary to deploy the components.
When running the command
odo deploy, odo searches for the default command of kind
deploy in the devfile, and executes this command.
deploy is supported by the devfile format starting from version 2.2.0.
deploy command is typically a composite command, composed of several apply commands:
- a command referencing an
imagecomponent that, when applied, will build the image of the container to deploy, and push it to its registry,
- a command referencing a
kubernetescomponent that, when applied, will create a Kubernetes resource in the cluster.
With the following example
devfile.yaml file, a container image will be built by using the
Dockerfile present in the directory,
the image will be pushed to its registry and a Kubernetes Deployment will be created in the cluster, using this freshly built image.