Journey with Red Hat CodeReady Containers at My Local
CodeReady Containers is the quickest way to get started building OpenShift clusters. It is designed to run on a local computer to simplify setup and testing, and emulate the cloud development environment locally with all of the tools needed to develop container-based applications.
Guide
Prerequisites and required packages are listed on :
Setup
You must have a redhat account to install openshift 4 on your local machine. If you have already one, login with your account the link below
CodeReady Containers (CRC) runs on Linux, MacOS, and Windows, and it only supports the native hypervisors: KVM for Linux, Hyperkit for MacOS, and HyperV for Windows.
Download and open the CodeReady Containers file. Opening the file will automatically start a step-by-step installation guide. After that Download or copy your pull secret. You’ll be prompted for this information during installation. And setup host machine for CodeReady Containers
retya@Retyas-MacBook-Pro file % crc setupCodeReady Containers is constantly improving and we would like to know more about usage (more details at https://developers.redhat.com/article/tool-data-collection)Your preference can be changed manually if desired using 'crc config set consent-telemetry <yes/no>'Would you like to contribute anonymous usage statistics? [y/N]: yThanks for helping us! You can disable telemetry with the command 'crc config set consent-telemetry no'.INFO Checking if running as non-rootINFO Checking if crc-admin-helper executable is cachedINFO Checking for obsolete admin-helper executableINFO Checking if running on a supported CPU architectureINFO Checking minimum RAM requirementsINFO Checking if running emulated on a M1 CPUINFO Checking if HyperKit is installedINFO Checking if qcow-tool is installedINFO Checking if crc-driver-hyperkit is installedINFO Checking if CodeReady Containers daemon is runningINFO Checking if launchd configuration for tray existsINFO Creating launchd configuration for trayINFO Check if CodeReady Containers tray is runningINFO Checking if CRC bundle is extracted in '$HOME/.crc'INFO Checking if /Applications/CodeReady Containers.app/Contents/Resources/crc_hyperkit_4.9.12.crcbundle existsINFO Extracting bundle from the CRC executableINFO Ensuring directory /Applications/CodeReady Containers.app/Contents/Resources existsINFO Uncompressing crc_hyperkit_4.9.12.crcbundlecrc.qcow2: 11.69 GiB / 11.69 GiB [-----------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%Your system is correctly setup for using CodeReady Containers, you can now run 'crc start' to start the OpenShift cluster
You can check the configurable options of crc with command bellow
retya@Retyas-MacBook-Pro file % crc config view
- consent-telemetry : yes
Start CodeReady Containers and copy and paste secret file during installation.
retya@Retyas-MacBook-Pro file % crc startINFO Checking if running as non-rootINFO Checking if crc-admin-helper executable is cachedINFO Checking for obsolete admin-helper executableINFO Checking if running on a supported CPU architectureINFO Checking minimum RAM requirementsINFO Checking if running emulated on a M1 CPUINFO Checking if HyperKit is installedINFO Checking if qcow-tool is installedINFO Checking if crc-driver-hyperkit is installedCodeReady Containers requires a pull secret to download content from Red Hat.You can copy it from the Pull Secret section of https://cloud.redhat.com/openshift/create/local.? Please enter the pull secret *****************************************************************************************************************************************************************************INFO Loading bundle: crc_hyperkit_4.9.12...INFO Creating CodeReady Containers VM for OpenShift 4.9.12...INFO Generating new SSH Key pair...INFO Generating new password for the kubeadmin userINFO Starting CodeReady Containers VM for OpenShift 4.9.12...INFO CodeReady Containers instance is running with IP 127.0.0.1INFO CodeReady Containers VM is runningINFO Updating authorized keys...INFO Check internal and public DNS query...INFO Check DNS query from host...INFO Verifying validity of the kubelet certificates...INFO Starting OpenShift kubelet serviceINFO Waiting for kube-apiserver availability... [takes around 2min]INFO Adding user's pull secret to the cluster...INFO Updating SSH key to machine config resource...INFO Waiting for user's pull secret part of instance disk...INFO Changing the password for the kubeadmin userINFO Updating cluster ID...INFO Updating root CA cert to admin-kubeconfig-client-ca configmap...INFO Starting OpenShift cluster... [waiting for the cluster to stabilize]INFO All operators are available. Ensuring stability...INFO Operators are stable (2/3)...INFO Operators are stable (3/3)...INFO Adding crc-admin and crc-developer contexts to kubeconfig...Started the OpenShift cluster.
You need to wait a few minutes after that because OpenShift
is some times not completely started
retya@Retyas-MacBook-Pro file % crc statusCRC VM: RunningOpenShift: Running (v4.9.12)Disk Usage: 13.98GB of 32.74GB (Inside the CRC VM)Cache Usage: 12.78GBCache Directory: /Users/retya/.crc/cache
If your cluster is up, access it using command bellow
retya@Retyas-MacBook-Pro file % crc consoleOpening the OpenShift Web Console in the default browser...
Openshift Webconsole will automatically launch at your default browser and you will need to accept the self-signed certificates and then be presented
There are some more commands that you probably need:
- ‘crc stop’ stops the OpenShift cluster
- ‘crc delete’ completely deletes the cluster
- ‘eval $(crc oc-env)’ correctly sets the environment for the ‘oc’ CLI
CodeReady Containers gives you the full OpenShift 4 experience with the new Web Console and even includes the OperatorHub catalog to get started with Operators.