Red Hat OpenShift is the Kubernetes platform from Red Hat, and it's designed for the hybrid cloud. Red Hat OpenShift Container Platform runs on cloud services such as AWS, Azure, and Google Cloud. You can also install and run OpenShift Container Platform on bare metal, but doing so requires a somewhat "demanding" setup.
Is there an alternative available? Yes, there is. This is where Red Hat CodeReady Containers comes into play.
Red Hat CodeReady Containers (CRC) provides a minimal, preconfigured OpenShift 4 cluster on a laptop or desktop machine for development and testing purposes. CRC is delivered as a platform inside of the VM. Now, let's look at how to configure it!
Requirements
The general requirements for CodeReady Containers are:
- OS: CentOS 7.5-8x/RHEL 7.5-8x/Fedora (latest 2 releases)
- Download: pull-secret
- Login: Red Hat account
The physical requirements include:
- Four virtual CPUs (vCPUs)
- 9GB of memory (RAM)
- 35GB of storage space
Setting up
To set up CodeReady Containers, start by creating the crc directory, and then download and extract the crc package:
$ mkdir /home/<user>/crc
$ wget https://mirror.openshift.com/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz
$ tar -xvf crc-linux-amd64.tar.xz
Next, move the files to the crc directory and remove the downloaded package(s):
$ mv /home/<user>/crc-linux-<version>-amd64/* /home/<user>/crc
$ rm /home/<user>/crc-linux-amd64.tar.xz
$ rm -r /home/<user>/crc-linux-<version>-amd64
Change to the crc directory, make crc executable, and export your PATH like this:
$ cd /home/<user>/crc
$ chmod +x crc
$ export PATH=$PATH:/home/<user>/crc
Set up and start the cluster:
$ crc setup
$ crc start -p /<path-to-the-pull-secret-file>/pull-secret.txt
Set up the OC environment:
$ crc oc-env
$ eval $(crc oc-env)
Log in as the developer user:
$ oc login -u developer -p developer https://api.crc.testing:6443
$ oc logout
And then, log in as the platform’s admin:
$ oc login -u kubeadmin -p password https://api.crc.testing:6443
$ oc logout
Interacting with the cluster
The most common ways of interacting with the cluster include:
- Start the graphical web console:
$ crc console
- Display the cluster’s status:
$ crc status
- Shut down the OpenShift cluster:
$ crc stop
- Delete or kill the OpenShift cluster:
$ crc delete
Red Hat additionally provides odo (OpenShift Do), a CLI tool for developers, to manage application components on the OpenShift Container Platform. To make use of odo, run the following commands:
$ wget https://mirror.openshift.com/pub/openshift-v4/clients/odo/latest/odo-linux-amd64.tar.gz
$ tar -xvf odo-linux-amd64.tar.gz
$ mv /home/<user>/odo /home/<user>/crc
$ rm odo-linux-amd64.tar.gz
$ cd /home/<user>/crc
$ chmod +x odo
Running an application
After setting up CodeReady Containers on a local machine, how do you run an application on OCP 4? Let’s create the "Wild-West" example project:
$ cd /home/<user>/crc
$ export PATH=$PATH:/home/<user>/crc
$ crc start
$ odo login -u developer -p developer
$ mkdir /home/<user>/wild-west
$ cd /home/<user>/wild-west
$ git clone https://github.com/openshift-evangelists/Wild-West-Backend backend
$ git clone https://github.com/openshift-evangelists/Wild-West-Frontend frontend
$ odo project create wild-west
$ oc import-image openjdk18 --from=registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift --confirm
$ oc annotate istag/openjdk18:latest tags=builder
$ odo catalog list components
$ cd /home/<user>/wild-west/backend
$ mvn package
$ odo create openjdk18 backend --binary target/wildwest-1.0.jar
$ odo config view
$ odo push
$ odo list
$ cd /home/<user>/wild-west/frontend
$ odo create nodejs frontend
$ odo config view
$ odo push
$ odo list
$ odo link backend --port 8080
$ odo url create frontend --port 8080
$ odo push
$ odo list
Once you are finished, you can launch the new application via the web console with:
$ crc console
Wrapping up
Today we learned how to install OpenShift Container Platform on a notebook, create a project, and install an application that runs on top of the platform and can be launched from within the web console. Now it’s your turn to try CRC out on your own projects. The Red Hat CodeReady Containers documentation can certainly help.
저자 소개
I am running the latest editions of CentOS, Fedora, and Red Hat Enterprise Linux server and workstation operating systems on physical and virtual machines (VM).
My dedicated capabilities and interests are backup solutions & disaster recovery, hardware drivers, infrastructure deployment, storage management, and virtualization.
유사한 검색 결과
Simplify Red Hat Enterprise Linux provisioning in image builder with new Red Hat Lightspeed security and management integrations
F5 BIG-IP Virtual Edition is now validated for Red Hat OpenShift Virtualization
Can Kubernetes Help People Find Love? | Compiler
Scaling For Complexity With Container Adoption | Code Comments
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
가상화
온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래