Hybrid Development Mode
There are situations when running a service locally is faster than synchronizing code with a remote Development Container. For example, when doing frontend-only development or when working in an IDE-heavy context (e.g. Java/Spring) where the IDE may be pre-configured to run tests, start services, and connect debuggers.
Hybrid development mode enables you to run the service in development locally while keeping the rest of your application components on Okteto.
Using hybrid development mode might increase latency when accessing the rest of the services in the cluster.
To allow communication to and from the cluster and your local machine, an SSH server is deployed in the remote Development Container.
You can expose the local service to the services running in the cluster using the reverse
configuration for the Development Container.
If you want to forward a service running in the cluster to your local machine you can use the forward
configuration.
When using Hybrid development mode the command in your Okteto Manifest runs locally with the same environment variables as the original service running in the cluster. To achieve this, the following environment variables are added to the local process. This list is ordered from highest to lowest prevalence:
- Environment variables defined in the environment of the development container
- Environment variables defined in the original container spec
- Environment variables coming from configmaps defined in the original container spec
- Environment variables coming from secrets defined in the original container spec
- Environment variables defined in the container image
To enable hybrid
mode you need to configure the necessary ports to expose the local service to the cluster network.
This allows the components running in the cluster to communicate with the local service as if it was running directly in the cluster.
To do this you can make use of the reverse field in your Okteto Manifest, which will expose the configured port of your local machine to the desired port on the Development Container.
We have getting started guides for the following use cases: