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.
NoteYou 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
- In the OpenShift Container Platform web console, log in by using an account with cluster administrator privileges.
Create a new OpenShift project:
- In the left navigation menu, click Home > Project > Create Project.
-
Enter a project name, for example,
my-camel-k-project
, and then click Create.
- In the left navigation menu, click Operators > OperatorHub.
-
In the Filter by keyword text box, type
Camel K
and then click the Red Hat Integration - Camel K Operator card. - Read the information about the operator and then click Install. The Operator installation page opens.
Select the following subscription settings:
- Update Channel > latest
Choose among the following 2 options:
- Installation Mode > A specific namespace on the cluster > my-camel-k-project
- Installation Mode > All namespaces on the cluster (default) > Openshift operator
NoteIf you do not choose among the above two options, the system by default chooses a global namespace on the cluster then leading to openshift operator.
Approval Strategy > Automatic
NoteThe Installation mode > All namespaces on the cluster and Approval Strategy > Manual settings are also available if required by your environment.
- Click Install, and wait a few moments until the Camel K Operator is ready for use.
Download and install the Camel K CLI tool:
- From the Help menu (?) at the top of the OpenShift web console, select Command line tools.
- Scroll down to the kamel - Red Hat Integration - Camel K - Command Line Interface section.
- Click the link to download the binary for your local operating system (Linux, Mac, Windows).
- Unzip and install the CLI in your system path.
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.
Next step
(optional) Specifying Camel K resource limits
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:
- Setting deployment resources in the OpenShift documentation.
- Managing Resources for Containers in the Kubernetes documentation.
Procedure
- Log in to the OpenShift Web console.
- Select Operators > Installed Operators > Operator Details > Subscription.
Select Actions > Edit Subscription.
The file for the subscription opens in the YAML editor.
Under the
spec
section, add aconfig.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
- 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
- In the OpenShift Container Platform web console, log in by using an account with cluster administrator privileges.
- In the left navigation menu, click Operators > OperatorHub.
-
In the Filter by keyword text box, enter
Serverless
to find the OpenShift Serverless Operator. - Read the information about the Operator and then click Install to display the Operator subscription page.
Select the default subscription settings:
- Update Channel > Select the channel that matches your OpenShift version, for example, 4.12
- Installation Mode > All namespaces on the cluster
Approval Strategy > Automatic
NoteThe Approval Strategy > Manual setting is also available if required by your environment.
- Click Install, and wait a few moments until the Operator is ready for use.
Install the required Knative components using the steps in the OpenShift documentation:
(Optional) Download and install the OpenShift Serverless CLI tool:
- From the Help menu (?) at the top of the OpenShift web console, select Command line tools.
- Scroll down to the kn - OpenShift Serverless - Command Line Interface section.
- Click the link to download the binary for your local operating system (Linux, Mac, Windows)
- Unzip and install the CLI in your system path.
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
- Installing OpenShift Serverless in the OpenShift documentation
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
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 theIntegrationPlatform
resource, from thespec.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
Create a Secret from file using following command:
oc create secret generic maven-ca-certs --from-file=ca.crt
Reference the created Secret in the
IntegrationPlatform
resource, from thespec.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