CentOS Stream 8
Sponsored Link

CodeReady Containers : Install2022/02/25

 
Install CodeReady Containers that deploys RedHat OpenShift 4 Cluster on a single node.
Minimum hardweare requirements are follows to install CodeReady Containers.
* 4 CPU (vCPU)
* 9 GB of free memory
* 35 GB of storage space
[1]
It needs to setup CodeReady Containers as a common user.
However, some setup processes requires root privilege rightly,
so configure root escalation with sudo to a common user you'd like to use for this setup, refer to here of [1].
[2]
Access to the official site below and download CodeReady Containers installer and Pull-Secret text to your server.
To download them, it needs RedHat account to login the site.
⇒ https://cloud.redhat.com/openshift/create/local
[3] Login as the user you set privilege on [1] and setup CodeReady Containers.
Do not use su to become the user from root, login as the user because crc setup will be fail if login with su from root.
[cent@dlp ~]$
total 3079628
-rw-rw-r--. 1 cent cent 3153534932 Feb 25 10:44 crc-linux-amd64.tar.xz
-rw-rw-r--. 1 cent cent       2771 Feb 25 10:43 pull-secret.txt

[cent@dlp ~]$
tar Jxvf crc-linux-amd64.tar.xz

[cent@dlp ~]$
sudo mv ./crc-linux-1.39.0-amd64/crc /usr/local/bin/

[cent@dlp ~]$
sudo chown root. /usr/local/bin/crc

[cent@dlp ~]$
sudo chmod 755 /usr/local/bin/crc

[cent@dlp ~]$
crc version

CodeReady Containers version: 1.39.0+ba8a8acc
OpenShift version: 4.9.15 (embedded in executable)

# setup pre-requisites for CodeReady Containers installation

[cent@dlp ~]$
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 running inside WSL2
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 crc executable symlink exists
INFO Checking if Virtualization is enabled
INFO Checking if KVM is enabled
INFO Checking if libvirt is installed
INFO Checking if user is part of libvirt group
INFO Checking if active user/process is currently part of the libvirt group
INFO Checking if libvirt daemon is running
INFO Checking if a supported libvirt version is installed
INFO Checking if crc-driver-libvirt is installed
INFO Checking crc daemon systemd service
INFO Checking crc daemon systemd socket units
INFO Setting up crc daemon systemd socket units
INFO Checking if systemd-networkd is running
INFO Checking if NetworkManager is installed
INFO Checking if NetworkManager service is running
INFO Checking if /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf exists
INFO Writing Network Manager config for crc
INFO Using root access: Writing NetworkManager configuration to /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf
INFO Using root access: Changing permissions for /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf to 644
INFO Using root access: Executing systemctl daemon-reload command
INFO Using root access: Executing systemctl reload NetworkManager
INFO Checking if /etc/NetworkManager/dnsmasq.d/crc.conf exists
INFO Writing dnsmasq config for crc
INFO Using root access: Writing NetworkManager configuration to /etc/NetworkManager/dnsmasq.d/crc.conf
INFO Using root access: Changing permissions for /etc/NetworkManager/dnsmasq.d/crc.conf to 644
INFO Using root access: Executing systemctl daemon-reload command
INFO Using root access: Executing systemctl reload NetworkManager
INFO Checking if libvirt 'crc' network is available
INFO Setting up libvirt 'crc' network
INFO Checking if libvirt 'crc' network is active
INFO Starting libvirt 'crc' network
INFO Checking if CRC bundle is extracted in '$HOME/.crc'
INFO Checking if /home/cent/.crc/cache/crc_libvirt_4.9.15.crcbundle exists
INFO Extracting bundle from the CRC executable
INFO Ensuring directory /home/cent/.crc/cache exists
INFO Extracting embedded bundle crc_libvirt_4.9.15.crcbundle to /home/cent/.crc/cache
INFO Uncompressing crc_libvirt_4.9.15.crcbundle

Your system is correctly setup for using CodeReady Containers, you can now run 'crc start' to start the OpenShift cluster

# setup CodeReady Containers with specifying Pull-Secret you downloaded

[cent@dlp ~]$
crc start -p pull-secret.txt

INFO Checking if running as non-root
INFO Checking if running inside WSL2
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 crc executable symlink exists
INFO Checking if Virtualization is enabled
INFO Checking if KVM is enabled
INFO Checking if libvirt is installed
INFO Checking if user is part of libvirt group
INFO Checking if active user/process is currently part of the libvirt group
INFO Checking if libvirt daemon is running
INFO Checking if a supported libvirt version is installed
INFO Checking if crc-driver-libvirt is installed
INFO Checking crc daemon systemd socket units
INFO Checking if systemd-networkd is running
INFO Checking if NetworkManager is installed
INFO Checking if NetworkManager service is running
INFO Checking if /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf exists
INFO Checking if /etc/NetworkManager/dnsmasq.d/crc.conf exists
INFO Checking if libvirt 'crc' network is available
INFO Checking if libvirt 'crc' network is active
INFO Loading bundle: crc_libvirt_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 192.168.130.11
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 Operator openshift-controller-manager is progressing
INFO Operator kube-apiserver is progressing
INFO 2 operators are progressing: authentication, kube-apiserver
INFO Operator authentication is progressing
INFO Operator authentication is progressing
INFO Operator authentication is progressing
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: mvA2Q-CL922-ego9R-kBwie

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

# that's OK if [Started the OpenShift cluster] is shown
[4] Verify installation to login to OpenShift Cluster.
[cent@dlp ~]$
eval $(crc oc-env)

[cent@dlp ~]$
oc login -u kubeadmin https://api.crc.testing:6443

Logged into "https://api.crc.testing:6443" as "kubeadmin" using existing credentials.

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

Using project "default".

[cent@dlp ~]$
oc get nodes

NAME                 STATUS   ROLES           AGE   VERSION
crc-8rwmc-master-0   Ready    master,worker   28d   v1.22.3+e790d7f

[cent@dlp ~]$
oc get pods -A

NAMESPACE                                    NAME                                                     READY   STATUS      RESTARTS        AGE
openshift-apiserver-operator                 openshift-apiserver-operator-595488d966-tgfgs            1/1     Running     0               28d
openshift-apiserver                          apiserver-56bdf9c9c4-jzttk                               2/2     Running     0               27d
openshift-authentication-operator            authentication-operator-78cf46778-wpdpt                  1/1     Running     0               28d
openshift-authentication                     oauth-openshift-7dc7b6975d-8dl64                         1/1     Running     0               8m17s
openshift-cluster-machine-approver           machine-approver-74559b5df9-6ng9c                        2/2     Running     1 (13m ago)     28d
.....
.....
openshift-operator-lifecycle-manager         packageserver-76c948d469-xsd7f                           1/1     Running     0               28d
openshift-sdn                                sdn-controller-96fcg                                     1/1     Running     0               28d
openshift-sdn                                sdn-lstzh                                                2/2     Running     0               28d
openshift-service-ca-operator                service-ca-operator-668487d9b9-sgnx2                     1/1     Running     0               27d
openshift-service-ca                         service-ca-69d4cd64c7-pk2qx                              1/1     Running     0               28d

[cent@dlp ~]$
oc get service

NAME         TYPE           CLUSTER-IP   EXTERNAL-IP                            PORT(S)   AGE
kubernetes   ClusterIP      10.217.4.1   <none>                                 443/TCP   28d
openshift    ExternalName   <none>       kubernetes.default.svc.cluster.local   <none>    28d

[cent@dlp ~]$
oc get pv

NAME     CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM                                                 STORAGECLASS   REASON   AGE
pv0001   100Gi      RWO,ROX,RWX    Recycle          Bound       openshift-image-registry/crc-image-registry-storage                           27d
pv0002   100Gi      RWO,ROX,RWX    Recycle          Available                                                                                 27d
pv0003   100Gi      RWO,ROX,RWX    Recycle          Available                                                                                 27d
pv0004   100Gi      RWO,ROX,RWX    Recycle          Available                                                                                 27d
pv0005   100Gi      RWO,ROX,RWX    Recycle          Available                                                                                 27d
.....
.....
[5] To start or stop CodeReady Containers, run like follows.
# show status

[cent@dlp ~]$
crc status

CRC VM:          Running
OpenShift:       Running (v4.9.15)
Disk Usage:      13.56GB of 32.74GB (Inside the CRC VM)
Cache Usage:     15.85GB
Cache Directory: /home/cent/.crc/cache

# stop

[cent@dlp ~]$
crc stop
# start

[cent@dlp ~]$
crc start
# CodeReady Containers is running as a VM

[cent@dlp ~]$
sudo virsh list

 Id   Name   State
----------------------
 1    crc    running
Matched Content
Loading...