Openshift Tutorial: Installing and Configuring Red Hat

Author

Reads 595

Computer server in data center room
Credit: pexels.com, Computer server in data center room

To get started with Red Hat OpenShift, you'll need to have a basic understanding of containerization and Kubernetes. Red Hat OpenShift is built on top of Kubernetes, making it a powerful platform for deploying and managing containerized applications.

Red Hat OpenShift is a container application platform that allows you to easily build, deploy, and manage applications in a containerized environment. It provides a scalable and secure way to deploy applications.

First, you'll need to install Red Hat OpenShift on your system. This can be done using the OpenShift CLI, which is available on the Red Hat website. You can download the CLI and follow the installation instructions to get started.

Red Hat OpenShift supports a wide range of programming languages and frameworks, including Java, Python, and Ruby. This makes it a versatile platform for developers of all skill levels.

Prerequisites

To get started with this OpenShift tutorial, you'll need a few things in place.

Credit: youtube.com, Installing Red Hat OpenShift Local on Linux (Formerly CodeReady Containers - CRC) | techbeatly

You'll need access to a Kubernetes cluster deployed with OpenShift, which is a must-have for this tutorial.

A text editor is also necessary, as you'll be working with code and configurations.

Basic command line access is required, so make sure you have that set up on your machine.

A Red Hat account is also necessary, as you'll need to access their resources and tools.

You'll also need the Consul CLI, which is a command-line interface for managing Consul.

Here's a list of the software tools you'll need to download:

  • CodeReady Containers v2.33.0-4.14.12+
  • Helm v3.6+ or consul-k8s v1.4.2+

Additionally, you'll need to ensure you have the following prerequisites in place:

  • Jump host to run the installation software from
  • A pull secret file/key from the Red Hat Cloud Console website
  • Access to the DNS server which supports the infrastructure platform that we are deploying to
  • A SSH Key used for access to the deployed OpenShift nodes

Getting Started

To get started with OpenShift, you'll need to login to the cluster using the login command you noted down earlier. Replace the secret password with the value output by CRC.

First, create an OpenShift project to install Consul on Kubernetes, which will create a Kubernetes namespace to deploy resources.

Login to the

Login to the OpenShift cluster is the next step after setting up the CRC service. You'll need to use the login command you made note of earlier to authenticate with the OpenShift cluster.

To do this, replace the secret password below with the value output by CRC. This will allow you to access the cluster.

Once you've authenticated, you can use the OpenShift cluster to create applications and check the cluster status.

A New Project

Credit: youtube.com, How to Start a Project - 5 Key Steps

Creating a new project is a straightforward process. You can create a new OpenShift project, which will automatically create a Kubernetes namespace to deploy resources.

In OpenShift, creating a project is the first step to installing Consul on Kubernetes. This process is essential for deploying Kubernetes resources.

To simulate an active environment, you can create a project named 'demo' to deploy a client and server. This will allow you to test and experiment with different scenarios.

Creating a new project gives you the flexibility to deploy different applications and services, such as the hello-world style application. This application uses a pre-existing Docker image, which can be found on the Docker Hub website.

The Docker image used for the hello-world application is openshift/hello-openshift. This image has already been pulled into your VM, making it easy to deploy and test.

Configuring Environment

To get started with OpenShift, you need to configure your environment. First, export the target namespace as an environment variable. This is a crucial step that sets the stage for the rest of the process.

This involves using a specific command to set up the environment. The command is as instructed by CRC, which is the Configuration Repository Client. You'll need to follow the instructions provided by CRC to complete this step.

Configure CRC Environment

Credit: youtube.com, What are Environment Variables, and how do I use them? (get,set)

To configure the CRC environment, you need to export the target namespace as an environment variable. This is the first step in setting up your CRC environment.

The command to export the target namespace as an environment variable is not explicitly stated, but it's mentioned as something you need to do.

Next, you'll need to start the CRC service with a specific command. This command will perform some system checks to ensure your system meets the minimum requirements.

The command to start the CRC service is not explicitly stated, but it's mentioned that you'll be prompted to provide an image pull secret. You should have your Red Hat account open to easily copy the image pull secret.

To start the CRC service, you'll need to paste the image pull secret into the terminal and press enter. Make sure to copy the secret from your Red Hat account before doing so.

Notice that the output will instruct you to configure your oc-env, and also include a login command and secret password. This command will be specific to your installation and you'll need to make note of it to login to CRC on your development host later.

Configure

Credit: youtube.com, App Configuration, where does it go? Config files, env vars, external service?

To configure your environment, start by exporting the target namespace as an environment variable. This is crucial for setting up your CRC environment.

You can customize your deployment by passing a YAML configuration file to be used during the deployment. This is done by creating a file named values.yaml that you will reference in the helm install command later.

The values.yaml file allows you to override the Helm chart's default settings. For example, you can set the global.openshift.enabled entry to true, which is required to operate Consul on OpenShift.

Helm Chart Configuration

To customize your deployment, you can pass a YAML configuration file to be used during the deployment. Any values specified in the values file will override the Helm chart's default settings.

You can generate a file named values.yaml to set specific configuration options, such as the global.openshift.enabled entry to true, which is required to operate Consul on OpenShift.

You can use the following example to create a values.yaml file: Set global.openshift.enabled to true This will ensure that Consul is configured correctly for OpenShift.

This configuration file can then be referenced in the helm install command later.

Helm Chart Configuration

Credit: youtube.com, How to Create Helm Charts - The Ultimate Guide

To customize your deployment, you can pass a YAML configuration file to be used during the deployment. Any values specified in the values file will override the Helm chart's default settings.

The values file is used to set specific configurations, such as the global.openshift.enabled entry, which is required to operate Consul on OpenShift. Generate a file named values.yaml that you will reference in the helm install command later.

You can customize your deployment by creating a values.yaml file that sets specific configurations. This file will override the Helm chart's default settings.

To ensure your values file is correct, you can review the Helm chart configuration documentation. This will give you a better understanding of the available configurations.

Here are the available configurations that can be set in the values file:

You can also use the values file to set other configurations, such as the image pull secret. This is required to pull images from the RedHat Registry.

Credit: youtube.com, What is Helm in Kubernetes? Helm and Helm Charts explained | Kubernetes Tutorial 23

The image pull secret is used to authenticate to the RedHat Registry. You must create a registry service account on the RedHat Customer Portal and then apply the OpenShift secret associated with the registry service account.

To ensure you have the correct image pull secret, you can search your local repo for version 1.4.2 of the Helm chart. If the correct version is not displayed, try updating your helm repo.

With your values file and image pull secret in place, you can now deploy a complete Consul datacenter in your Kubernetes cluster using the official Consul Helm chart.

Import Images from RedHat Catalog

Importing images from the RedHat Catalog can be a convenient alternative to pulling images directly from the RedHat Registry. You can use the oc import command to pre-load Consul and Consul on Kubernetes images onto the internal OpenShift registry.

To import images, you'll need to read more about the process in the RedHat OpenShift cookbook. This resource provides detailed information on how to import images into the internal OpenShift Registry.

Credit: youtube.com, Red Hat Container Catalog - choosing the right base image for your application, by Dirk Herrmann

Here are the steps you can follow to import images from the RedHat Catalog:

By importing images from the RedHat Catalog, you can streamline your application deployment process and reduce the time it takes to get up and running.

Installing Red Hat Container Platform on Alibaba Cloud

To install Red Hat OpenShift Container Platform on Alibaba Cloud, start by creating an SSH key and adding it to an agent on the installer instance.

First, you'll need to create a CoreOS image in the .qcow2 format for the master machines, as described in step 2.2.

Before proceeding, set the region to China (Hangzhou) and create a custom image for the bootstrap, master, and worker machines, as outlined in steps 2.4 and 2.3.

On Alibaba Cloud, you can create a Kubernetes manifest and ignition files on the installer instance, which is a crucial step in the installation process, as mentioned in step 1.5.

Credit: youtube.com, Helm Chart - OpenShift Build and Deploymant (OpenShift Tutorial Part-9) Red Hat EX288

To configure the installation, create a CoreOS image in qcow2 format for the worker machines, just like you did for the master machines.

Next, create a custom image for the worker machines, following the same process as for the master machines.

After setting up the images, create a CLB (Classic Load Balancer) by clicking the "Create CLB" button, as instructed in step 2.2.

Verify that the IP address of the SLB instance is correct, which can be done by returning to the Instances page and checking the IP address.

To complete the installation, log on to the cluster and check the installation, as described in step 2.8.

Once the installation is complete, you can create an application by switching to the developer view and clicking "+Add" on the left-side of the navigation pane.

In the administrator view, choose Home > Projects and click Create Project to create a new project, such as demoproject, as outlined in step 3.2.

Importing Images

Credit: youtube.com, Create a custom s2i image for OpenShift

You can import images into your OpenShift environment in a few different ways.

Before pulling images directly from the RedHat Registry, you'll need to create an image pull secret, which involves creating a registry service account on the RedHat Customer Portal.

Instead of pulling images directly, you can pre-load Consul and Consul on Kubernetes images onto the internal OpenShift registry using the oc import command.

To create a new OpenShift app from a Docker image, you can specify a full URL to some other Docker registry, such as Google, or provide the image details in yaml format.

You'll need to update the imagePullSecrets stanza in the Helm chart values file with the output of the command to create the image pull secret.

Installation

To install OpenShift, you can create a Kubernetes manifest and ignition files on the installer instance. This can be achieved by running the command `openshift-install create manifests`. This will create the manifests folder which controls the provisioning of the cluster.

Credit: youtube.com, Openshift Tutorial - Basics & Setup

The manifests folder is crucial for deploying Cilium, as it provides OpenShift with the additional configuration files to bootstrap the cluster with Cilium. To create the install-config.yaml file, you can run the command `openshift-install create install-config`, which will run through a wizard to create the file.

You can also install OpenShift on Alibaba Cloud by following the instructions on how to install and deploy Red Hat OpenShift Container Platform 4.6. This involves creating an SSH key, adding it to an agent, and installing a CLI client on the installer instance.

Install Consul

Installing Consul on your Kubernetes cluster can be done using the official Consul Helm chart or the Consul K8S CLI.

You'll need to use the Consul K8S CLI tool to quickly install and interact with Consul on Kubernetes. Make sure to install the correct version of the CLI for your Consul on Kubernetes deployment, as it's version dependent.

To install Consul, you can use the helm install command. This command specifies the installation settings, including the use of a custom values file, the Consul Helm chart, and the Consul installation name.

Credit: youtube.com, Consul installer

The helm install command should include the following options:

  • Use the custom values file you created earlier
  • Use the hashicorp/consul chart you downloaded in the last step
  • Set your Consul installation name to consul
  • Create Consul resources in the consul namespace
  • Use consul-helm chart version 1.4.2

The output of the helm install command will be similar to the following.

Verify Installation

Verify Installation is a crucial step to ensure your setup is working correctly.

Use kubectl get pods to verify your installation. This command will give you an overview of the pods in your cluster.

Once all pods have a status of Running, you can proceed with the next steps.

Installing Cilium

Installing Cilium involves several steps, including choosing the right installation method for your OpenShift cluster. Red Hat OpenShift Container Platform offers three flexible installation methods: Installer provisioned infrastructure (IPI), User provisioned infrastructure (UPI), and Agent-based.

To begin, you'll need to check the support matrix for Red Hat OpenShift and Cilium versions. This will ensure that your cluster is compatible with the version of Cilium you plan to install. You can find the support matrix here.

You'll also need to obtain a copy of the Cilium Operator Lifecycle Manager (OLM) manifest files. These files will be used to configure your cluster with Cilium.

Credit: youtube.com, Mastering the Cilium CLI to install Cilium on your Kubernetes Platform

To create the OpenShift installation manifests, you can run the command `openshift-install create cluster`. This will run through a wizard to create the `install-config.yaml` file and then create the cluster automatically using Terraform.

However, if you're planning to use the Cilium CNI, you'll need to modify the `install-config.yaml` file to set `networkType` to `Cilium`. You'll also need to configure the network address CIDRs as necessary for your environment.

Here are the steps to create the `install-config.yaml` file:

  • Run `openshift-install create install-config` to run through the wizard and create the file.
  • Edit the `install-config.yaml` file to set `networkType` to `Cilium` and configure the network address CIDRs.
  • Copy the Cilium manifests into the `manifests` folder.

The `manifests` folder is used to control the provisioning of the cluster. To create this folder, run the command `openshift-install create manifests`. This will create the folder and allow you to add additional Cilium YAML files.

Once you've created the `manifests` folder, you can configure Cilium by modifying the `cluster-network-07-cilium-ciliumconfig.yaml` file. This file controls the configuration of Cilium, including the enablement of Hubble Metrics and Prometheus Service Monitors.

Here's an example of how to configure Cilium:

  • Set `networkType` to `Cilium` in the `cluster-network-02-operator.yml` file.
  • Configure the cluster network and service network CIDRs in the `cluster-network-02-operator.yml` file.
  • Modify the `cluster-network-07-cilium-ciliumconfig.yaml` file to enable Hubble Metrics and Prometheus Service Monitors.

By following these steps, you'll be able to install Cilium on your OpenShift cluster using the IPI installation method.

OCP Installation Preparation

Credit: youtube.com, gi-runner - OCP and GI installation automation

To prepare for OCP installation, start by creating an SSH key and adding it to an agent on the installer instance.

You'll also need to install a CLI client on the installer instance, which is a crucial step in the process.

Before creating the install-config.yaml file, you'll need to create a Kubernetes manifest and ignition files on the installer instance.

This will help you get started with the installation process.

Create a CoreOS image in the .qcow2 format for the master machines, which is a necessary step in the installation process.

Create a CoreOS image in qcow2 format for the worker machines, just like you did for the master machines.

Frequently Asked Questions

What is OpenShift used for?

OpenShift is a platform that simplifies Kubernetes management, enhancing developer productivity and speeding up development. It streamlines CI/CD processes, making it easier to set up and manage applications.

How to learn OpenShift from scratch?

Start with OpenShift local, a self-contained environment for hands-on learning, and progress to Dev Sandbox and full production-level clusters to master OpenShift fundamentals

Mona Renner

Senior Copy Editor

Mona Renner is a meticulous and detail-driven Copy Editor with a passion for refining complex concepts into clear and concise language. With a keen eye for grammar and syntax, she has honed her skills in editing articles across a range of technical topics, including Google Drive APIs. Her expertise lies in distilling technical jargon into accessible and engaging content that resonates with diverse audiences.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.