What is Red Hat CodeReady Containers

  • an OpenShift 4 cluster for local development
  • minimum 4 vCPU, 8 GB RAM, 35 GB storage

CodeReady Containers is designed for local development and testing on an OpenShift 4 cluster. The CodeReady Containers requires at least:

  • 4 virtual CPUs (vCPUs)
  • 8 GB of RAM memory
  • 35 GB of storage space

Playbook

How to Install Red Hat CodeReady Containers in MacOS and simple usage.

Red Hat CodeReady Containers website

Red Hat CodeReady Containers download

Red Hat CodeReady Containers macOS installer

cluster setup

ansible-pilot $ crc status
Machine does not exist. Use 'crc start' to create it
ansible-pilot $ crc setup 
CodeReady 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]: y
Thanks for helping us! You can disable telemetry with the command 'crc config set consent-telemetry no'.
INFO Checking if running as non-root              
INFO Checking if crc-admin-helper executable is cached 
INFO Checking for obsolete admin-helper executable 
INFO Checking if running on a supported CPU architecture 
INFO Checking minimum RAM requirements            
INFO Checking if running emulated on a M1 CPU     
INFO Checking if HyperKit is installed            
INFO Checking if qcow-tool is installed           
INFO Checking if crc-driver-hyperkit is installed 
INFO Checking if CodeReady Containers daemon is running 
INFO Checking if launchd configuration for tray exists 
INFO Creating launchd configuration for tray      
INFO Check if CodeReady Containers tray is running 
INFO Checking if CRC bundle is extracted in '$HOME/.crc' 
INFO Checking if /Applications/CodeReady Containers.app/Contents/Resources/crc_hyperkit_4.9.15.crcbundle exists 
INFO Extracting bundle from the CRC executable    
INFO Ensuring directory /Applications/CodeReady Containers.app/Contents/Resources exists 
INFO Uncompressing crc_hyperkit_4.9.15.crcbundle  
crc.qcow2: 11.70 GiB / 11.70 GiB [--------------------------------------------------------] 100.00%
Your system is correctly setup for using CodeReady Containers, you can now run 'crc start' to start the OpenShift cluster

cluster start

ansible-pilot $ crc start
INFO Checking if running as non-root              
INFO Checking if crc-admin-helper executable is cached 
INFO Checking for obsolete admin-helper executable 
INFO Checking if running on a supported CPU architecture 
INFO Checking minimum RAM requirements            
INFO Checking if running emulated on a M1 CPU     
INFO Checking if HyperKit is installed            
INFO Checking if qcow-tool is installed           
INFO Checking if crc-driver-hyperkit is installed 
CodeReady 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.15...       
INFO Creating CodeReady Containers VM for OpenShift 4.9.15... 
INFO Generating new SSH Key pair...               
INFO Generating new password for the kubeadmin user 
INFO Starting CodeReady Containers VM for OpenShift 4.9.15... 
INFO CodeReady Containers instance is running with IP 127.0.0.1 
INFO CodeReady Containers VM is running           
INFO 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 service           
INFO 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 user 
INFO 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.
The server is accessible via web console at:
  https://console-openshift-console.apps-crc.testing
Log in as administrator:
  Username: kubeadmin
  Password: YSW9N-SmFPP-jiu2f-nNmfc
Log in as user:
  Username: developer
  Password: developer
Use the 'oc' command line interface:
  $ eval $(crc oc-env)
  $ oc login -u developer https://api.crc.testing:6443
ansible-pilot $

cluster status

ansible-pilot $ oc status
In project example on server https://api.crc.testing:6443
You have no services, deployment configs, or build configs.
Run 'oc new-app' to create an application.
ansible-pilot $ crc status
CRC VM:          Running
OpenShift:       Running (v4.9.15)
Disk Usage:      13.36GB of 32.74GB (Inside the CRC VM)
Cache Usage:     12.79GB
Cache Directory: /Users/lberton/.crc/cache
ansible-pilot $
cluster example project
Started the OpenShift cluster.
The server is accessible via web console at:
  https://console-openshift-console.apps-crc.testing
Log in as administrator:
  Username: kubeadmin
  Password: WhDvM-c8WiV-zJ8iH-UKhKV
Log in as user:
  Username: developer
  Password: developer
Use the 'oc' command line interface:
  $ eval $(crc oc-env)
  $ oc login -u developer https://api.crc.testing:6443
ansible-pilot $ eval $(crc oc-env)
ansible-pilot $ oc login -u developer https://api.crc.testing:6443
Logged into "https://api.crc.testing:6443" as "developer" using existing credentials.
You don't have any projects. You can try to create a new project, by running
oc new-project <projectname>
ansible-pilot $ oc new-project example
Now using project "example" on server "https://api.crc.testing:6443".
You can add applications to this project with the 'new-app' command. For example, try:
oc new-app rails-postgresql-example
to build a new example application in Ruby. Or use kubectl to deploy a simple Kubernetes application:
kubectl create deployment hello-node --image=k8s.gcr.io/serve_hostname
ansible-pilot $

cluster webui

The server is accessible via web console at: https://console-openshift-console.apps-crc.testing

Red Hat CodeReady Containers webui

cluster stop

ansible-pilot $ crc stop
INFO Stopping kubelet and all containers...       
INFO Stopping the OpenShift cluster, this may take a few minutes... 
Stopped the OpenShift cluster
ansible-pilot $ crc status
CRC VM:          Stopped
OpenShift:       Stopped (v4.9.15)
Disk Usage:      0B of 0B (Inside the CRC VM)
Cache Usage:     12.79GB
Cache Directory: /Users/lberton/.crc/cache
ansible-pilot $

cluster restart

ansible-pilot $ crc stop
INFO Stopping kubelet and all containers...       
INFO Stopping the OpenShift cluster, this may take a few minutes... 
Stopped the OpenShift cluster
ansible-pilot $ crc status
CRC VM:          Stopped
OpenShift:       Stopped (v4.9.15)
Disk Usage:      0B of 0B (Inside the CRC VM)
Cache Usage:     12.79GB
Cache Directory: /Users/lberton/.crc/cache
ansible-pilot $ crc start
INFO Checking if running as non-root              
INFO Checking if crc-admin-helper executable is cached 
INFO Checking for obsolete admin-helper executable 
INFO Checking if running on a supported CPU architecture 
INFO Checking minimum RAM requirements            
INFO Checking if running emulated on a M1 CPU     
INFO Checking if HyperKit is installed            
INFO Checking if qcow-tool is installed           
INFO Checking if crc-driver-hyperkit is installed 
INFO Starting CodeReady Containers VM for OpenShift 4.9.15... 
INFO CodeReady Containers instance is running with IP 127.0.0.1 
INFO CodeReady Containers VM is running           
INFO Check internal and public DNS query...       
INFO Check DNS query from host...                 
INFO Verifying validity of the kubelet certificates... 
INFO Starting OpenShift kubelet service           
INFO Waiting for kube-apiserver availability... [takes around 2min] 
INFO Waiting for user\'s pull secret part of instance disk... 
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.
The server is accessible via web console at:
  https://console-openshift-console.apps-crc.testing
Log in as administrator:
  Username: kubeadmin
  Password: WhDvM-c8WiV-zJ8iH-UKhKV
Log in as user:
  Username: developer
  Password: developer
Use the 'oc' command line interface:
  $ eval $(crc oc-env)
  $ oc login -u developer https://api.crc.testing:6443
ansible-pilot $

Conclusion

Now you know how to install Red Hat CodeReady Containers in MacOS and how to manage the OpenShifft 4 cluster, start, stop, restart, status.

Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.

Academy

Learn the Ansible automation technology with some real-life examples in my Udemy 300+ Lessons Video Course.

BUY the Complete Udemy 300+ Lessons Video Course

My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps

BUY the Complete PDF BOOK to easily Copy and Paste the 250+ Ansible code

Want to keep this project going? Please donate

Patreon Buy me a Pizza