OpenShift Code Ready Containers Guide

Openshift code ready container(crc) is a lightweight openshfit environment for developers, it can be installed on a single standalone vm or on your laptop. I will describe how to install and configure it on centos/rhel 8 system.

1, prerequisites

OS: centos-stream 8 or rhel 8, with 4 core 16G memory. if you do not need monitoring stack, 9G memory is okay.

virtualization enabled: for vm on vmware infrastructure, configure your vm cpu with hardware virtualization enabled, for openstack/libvirt infrastructure, configure vm cpu with host-passthrough capability.

A non-root user: create a normal user with sudo privilege enabled. and then login with this user. do not login with root and then su to normal user.

2, installation

download crc installation binary file here,(https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/), select the version as you want, for openshift 4.10, crc version is 2.6.0, for 4.11, choose version above 2.7.

wget https://developers.redhat.com/content-gateway/file/pub/openshift-v4/clients/crc/2.6.0/crc-linux-amd64.tar.xz

tar xf crc-linux-amd64.tar.xz

cp crc-linux-2.6.0-amd64/crc /usr/local/bin

configure crc parameters, below is an example, update these parameters for your environment with crc config set command.

[shaun@crc-410 ~]$ crc config view
- consent-telemetry                     : no
- cpus                                  : 6
- disk-size                             : 80
- enable-cluster-monitoring             : true
- memory                                : 24576
- pull-secret-file                      : /home/shaun/pull-secret.txt

/home/shaun/pull-secret.txt

this is the image pull credentials file downloaded from here

after configuration, run the following command to start installation, this may take a while,

crc setup

crc start

After installation, run crc oc-env to get oc binary path, and add it to your $PATH environment,

[shaun@crc-410 ~]$ crc oc-env
export PATH="/home/shaun/.crc/bin/oc:$PATH"
# Run this command to configure your shell:
# eval $(crc oc-env)

To login with kubeadmin user, get its password in .crc/machines/crc/kubeadmin-password file

[shaun@crc-410 ~]$ cat .crc/machines/crc/kubeadmin-password
ITnXU-*****-*****-3SUZj[shaun@crc-410 ~]$
[shaun@crc-410 ~]$ oc login -ukubeadmin
Authentication required for https://api.crc.testing:6443 (openshift)
Username: kubeadmin
Password:
Login successful.

You have access to 67 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".
[shaun@crc-410 ~]$

Get crc vm ip, default is 192.168.130.11

[shaun@crc-410 ~]$ crc ip
192.168.130.11

For troubleshooting, login to the crc vm using command ssh -i .crc/machines/crc/id_ecdsa core@192.168.130.11

[shaun@crc-410 ~]$ ssh -i .crc/machines/crc/id_ecdsa core@192.168.130.11
Red Hat Enterprise Linux CoreOS 410.84.202207051718-0
  Part of OpenShift 4.10, RHCOS is a Kubernetes native operating system
  managed by the Machine Config Operator (`clusteroperator/machine-config`).

WARNING: Direct SSH access to machines is not recommended; instead,
make configuration changes via `machineconfig` objects:
  https://docs.openshift.com/container-platform/4.10/architecture/architecture-rhcos.html

---
Last login: Mon Dec  5 04:28:39 2022 from 192.168.130.1
[core@crc-sjtnl-master-0 ~]$

Leave a Reply

Your email address will not be published. Required fields are marked *