Local development environment

If you plan on contributing to Camel K, you will end up needing to run and troubleshoot your operator code locally. Here is a guideline that will help you configure your local operator running.

Running a development operator

As soon as you build your operator locally you will ask yourself how to test it. In the past, we used to have the possibility to run the operator on the same development machine and connect to Kubernetes cluster. However, that approach was quite cumbersome, so now we propose a way to locally install and run your development Camel K operator as it was a "normal" installation.

Once you have done your development, you will need to build and push Camel K Operator container image to the container registry your Kubernetes is later going to use. If you’re on a local machine, you are probably using Minikube or Kind. In such case you can make your Docker daemon to use the cluster container registry. In Minikube it would be like the following:

eval $(minikube -p minikube docker-env)

For other cluster types you may check the specific documentation. As soon as you’re connected to the Docker daemon you can build images via:

make images

This command will build and publish your actual Camel K development version to the container registry. At this stage installing the Camel K development version will be as easy as a typical installation:

./kamel install

You can provide any customization required such as --log-level, --operator-id, etcetera. Mind that you need to use ./kamel in order to use the development binary you’ve just built, as tipically, kamel is the production CLI you have installed in your binary path.

Local Camel K runtime

Camel K integrations are based on Camel K runtime, generally paired with the operator release. If you need to specify a different runtime, or you have a local Camel K Runtime that you want to test you need to build a Camel K version bundled with the local Camel K Runtime bits

make images CAMEL_K_RUNTIME_DIR=<path/to/local/ck-runtime/project>

Once this is done you need to re-install via ./kamel install.

Local Multiple Architecture

Since Camel K version 2 we’re introducing the support for multiple architecture. If you want to build your container image operator for a specific architecture, you can provide a parameter, IMAGE_ARCH. See the example:

IMAGE_ARCH=arm64 make images

With this configuration, you will build an ARM64 architecture container image that you can reference later as apache/camel-k:<version>-arm64.