Setup

Install Apache Camel K

Download the latest Apache Camel K release from here. Extract the content and add the binary kamel to the PATH.

As of building this tutorial the latest kamel version was 1.11.0

  • Minikube

  • OpenShift

kamel install --namespace knativetutorial --olm=false --wait

As with other installations in this tutorial, this process will take a few minutes for the Apache Camel K pods to be up and running. You can monitor the progress of the installation by watching the pods in namespace knativetutorial.

Camel K Pods
watch "kubectl -n knativetutorial get pods"

The Camel K install will take some time, please wait for the successful installation before proceeding to the further sections of this tutorial.

A successful Camel K setup will have the following pods running/completed in knativetutorial namespace:

NAME                                READY   STATUS      RESTARTS   AGE
camel-k-operator-84d7896b68-9mfdv   1/1     Running     0          2m7s

Camel K is installed using its operator.Use the Operator Hub in OpenShift webconsole to install the Camel K operator.

Once the operator is deployed successfully, run the following command to setup Camel K in the namespace:

kamel install --cluster-setup --skip-operator-setup

In OpenShift, the kamel install command will not install Camel K operator in each namespace, rather its done one time at cluster level when installing the Operator.

Configure Camel K to build faster

Camel K uses Apache Maven to build the integration kits and its related containers. The Apache Maven settings for Camel K are stored in a ConfigMap camel-k-maven-settings in the knativetutorial namespace. One of the ways to make the build faster is by using a maven repository manager such as Sonatype Nexus, the repository manager helps in caching the maven artifacts from remote repositories and serves them from local the subsequent times they are asked to be downloaded.

Edit the file $TUTORIAL_HOME/install/utils/camel-k-maven-settings.xml to adjust to your maven repository settings:

Create the ConfigMap using the command:

kubectl create configmap \
  -n knativetutorial my-camel-k-maven-settings \
  --from-file=settings.xml="$TUTORIAL_HOME/install/utils/camel-k-maven-settings.xml"

Install or Update Camel K and make it use the maven repository settings:

kamel install --force \(1)
  --maven-settings="configmap:my-camel-k-maven-settings/settings.xml" \
  --wait
1 --force is used to update any existing Camel K installs to use the new settings

Deploy Nexus to Local Cluster (Optional)

If you don’t have a Sonatype Nexus Repository, you can deploy one into the cluster using the deployment $TUTORIAL_HOME/install/utils/nexus/app.yaml.

kubectl apply -n knativetutorial -f $TUTORIAL_HOME/install/utils/nexus.yaml

Wait for the nexus pod to be ready:

watch kubectl get -n knativetutorial pods

Once nexus is running you should see the following pod in the knativetutorial:

NAME                                READY   STATUS    RESTARTS   AGE
camel-k-operator-65db5d46bb-llc6g   1/1     Running   0          22h
nexus-5dc54dd879-tlv2g              1/1     Running   0          9m49s

The nexus repository can be opened in your browser using the command:

minikube -p knativetutorial service -n knativetutorial nexus

You need to use user admin to login. Nexus uses a generated password, to retrieve the generated password run:

export NEXUS_POD=$(kubectl -n knativetutorial get pods \
  -lapp=nexus -ojsonpath='{.items[0].metadata.name}')
kubectl exec $NEXUS_POD -- cat /nexus-data/admin.password

You will be able to reset it after the first login. You can then Configure Camel K to build faster.