Chapter 2. Preparing your OpenShift cluster

This chapter explains how to install Red Hat Integration - Camel K and OpenShift Serverless on OpenShift, and how to install the required Camel K and OpenShift Serverless command-line client tools in your development environment.

2.1. Installing Camel K

You can install the Red Hat Integration - Camel K Operator on your OpenShift cluster from the OperatorHub. The OperatorHub is available from the OpenShift Container Platform web console and provides an interface for cluster administrators to discover and install Operators.

After you install the Camel K Operator, you can install the Camel K CLI tool for command line access to all Camel K features.

Prerequisites

  • You have access to an OpenShift 4.6 (or later) cluster with the correct access level, the ability to create projects and install operators, and the ability to install CLI tools on your local system.

    Note

    You do not need to create a pull secret when installing Camel K from the OpenShift OperatorHub. The Camel K Operator automatically reuses the OpenShift cluster-level authentication to pull the Camel K image from registry.redhat.io.

  • You installed the OpenShift CLI tool (oc) so that you can interact with the OpenShift cluster at the command line. For details on how to install the OpenShift CLI, see Installing the OpenShift CLI.

Procedure

  1. In the OpenShift Container Platform web console, log in by using an account with cluster administrator privileges.
  2. Create a new OpenShift project:

    1. In the left navigation menu, click Home > Project > Create Project.
    2. Enter a project name, for example, my-camel-k-project, and then click Create.
  3. In the left navigation menu, click Operators > OperatorHub.
  4. In the Filter by keyword text box, type Camel K and then click the Red Hat Integration - Camel K Operator card.
  5. Read the information about the operator and then click Install. The Operator installation page opens.
  6. Select the following subscription settings:

    • Update Channel > latest
    • Installation Mode > A specific namespace on the cluster > my-camel-k-project
    • Approval Strategy > Automatic

      Note

      The Installation mode > All namespaces on the cluster and Approval Strategy > Manual settings are also available if required by your environment.

  7. Click Install, and then wait a few moments until the Camel K Operator is ready for use.
  8. Download and install the Camel K CLI tool:

    1. From the Help menu (?) at the top of the OpenShift web console, select Command line tools.
    2. Scroll down to the kamel - Red Hat Integration - Camel K - Command Line Interface section.
    3. Click the link to download the binary for your local operating system (Linux, Mac, Windows).
    4. Unzip and install the CLI in your system path.
    5. To verify that you can access the Kamel K CLI, open a command window and then type the following:

      kamel --help

      This command shows information about Camel K CLI commands.

2.1.1. Specifying Camel K resource limits

When you install Camel K, the OpenShift pod for Camel K does not have any limits set for CPU and memory (RAM) resources. If you want to define resource limits for Camel K, you must edit the Camel K subscription resource that was created during the installation process.

Prerequisite

  • You have cluster administrator access to an OpenShift project in which the Camel K Operator is installed as described in Installing Camel K.
  • You know the resource limits that you want to apply to the Camel K subscription. For more information about resource limits, see the following documentation:

Procedure

  1. Log in to the OpenShift Web console.
  2. Select Operators > Installed Operators > Operator Details > Subscription.
  3. Select Actions > Edit Subscription.

    The file for the subscription opens in the YAML editor.

  4. Under the spec section, add a config.resources section and provide values for memory and cpu as shown in the following example:

    spec:
      channel: default
      config:
        resources:
          limits:
            memory: 512Mi
            cpu: 500m
          requests:
            cpu: 200m
            memory: 128Mi
  5. Save your changes.

OpenShift updates the subscription and applies the resource limits that you specified.

2.2. Installing OpenShift Serverless

You can install the OpenShift Serverless Operator on your OpenShift cluster from the OperatorHub. The OperatorHub is available from the OpenShift Container Platform web console and provides an interface for cluster administrators to discover and install Operators.

The OpenShift Serverless Operator supports both Knative Serving and Knative Eventing features. For more details, see installing OpenShift Serverless Operator.

Prerequisites

  • You have cluster administrator access to an OpenShift project in which the Camel K Operator is installed.
  • You installed the OpenShift CLI tool (oc) so that you can interact with the OpenShift cluster at the command line. For details on how to install the OpenShift CLI, see Installing the OpenShift CLI.

Procedure

  1. In the OpenShift Container Platform web console, log in by using an account with cluster administrator privileges.
  2. In the left navigation menu, click Operators > OperatorHub.
  3. In the Filter by keyword text box, enter Serverless to find the OpenShift Serverless Operator.
  4. Read the information about the Operator and then click Install to display the Operator subscription page.
  5. Select the default subscription settings:

    • Update Channel > Select the channel that matches your OpenShift version, for example, 4.10
    • Installation Mode > All namespaces on the cluster
    • Approval Strategy > Automatic

      Note

      The Approval Strategy > Manual setting is also available if required by your environment.

  6. Click Install, and wait a few moments until the Operator is ready for use.
  7. Install the required Knative components using the steps in the OpenShift documentation:

  8. (Optional) Download and install the OpenShift Serverless CLI tool:

    1. From the Help menu (?) at the top of the OpenShift web console, select Command line tools.
    2. Scroll down to the kn - OpenShift Serverless - Command Line Interface section.
    3. Click the link to download the binary for your local operating system (Linux, Mac, Windows)
    4. Unzip and install the CLI in your system path.
    5. To verify that you can access the kn CLI, open a command window and then type the following:

      kn --help

      This command shows information about OpenShift Serverless CLI commands.

      For more details, see the OpenShift Serverless CLI documentation.

Additional resources

2.3. Configuring Maven repository for Camel K

For Camel K operator, you can provide the Maven settings in a ConfigMap or a secret.

Procedure

  1. To create a ConfigMap from a file, run the following command.

    oc create configmap maven-settings --from-file=settings.xml

    Created ConfigMap can be then referenced in the IntegrationPlatform resource, from the spec.build.maven.settings field.

    Example

    apiVersion: camel.apache.org/v1
    kind: IntegrationPlatform
    metadata:
      name: camel-k
    spec:
      build:
         maven:
            settings:
               configMapKeyRef:
                    key: settings.xml
                    name: maven-settings

    Or you can edit the IntegrationPlatform resource directly to reference the ConfigMap that contains the Maven settings using following command:

    oc edit ip camel-k

Configuring CA certificates for remote Maven repositories

You can provide the CA certificates, used by the Maven commands to connect to the remote Maven repositories, in a Secret.

Procedure

  1. Create a Secret from file using following command:

    oc create secret generic maven-ca-certs --from-file=ca.crt
  2. Reference the created Secret in the IntegrationPlatform resource, from the spec.build.maven.caSecret field as shown below.

    apiVersion: camel.apache.org/v1
    kind: IntegrationPlatform
    metadata:
      name: camel-k
    spec:
      build:
          maven:
              caSecret:
                 key: tls.crt
                 name: tls-secret