Install OpenShift Local (Code Ready Containers)

Mindwatering Incorporated

Author: Tripp W Black

Created: 06/15 at 01:11 AM

 

Category:
RH OpenShift
Install

Task:
Create a single node OKD cluster.

VM: CRC1
Location: MWDC1 -> MWNet
Compute: MWDC1 > MWCluster1 > MWESX1
Storage: MWDC1NAS1

Administrative user: myadminid

Download location:
- At the time of this writing: mirror.openshift.com/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz

Pull Secret download location:
- At the time of this writing: console.redhat.com/openshift/create/local
- Required at the end of install


Steps:
1. Create New VM
a. vSphere client --> login --> Datacenter --> right-click --> New Virtual Machine ... -->

b. In the New Virtual Machine window, under Select a creation type, choose Create a new virtual machine, click NEXT -->

c. Under Select a name and folder:
- Virtual Machine Name: CRC1
- Select a location for the virtual machine: MWDC1 > vmhost1
- Click NEXT -->

d. Under Select a compute resource:
- MWDC1 > MWCluster1 > MWESX1
- Click NEXT -->

e. Under Select storage:
- MWDC1NAS1
- Click NEXT -->

f. Under Select compatibility:
- <take default>
- Click NEXT -->

g. Under Select a guest OS:
- Family: Linux
- Guest OS Version: Centos Stream 9 (or select Other 4.x or later Linux (64-bit) if not available)

h. Under Customize hardware:
Note: 64 GB is no longer enough, will fail on extraction
- CPU: 4
- Cores per Socket: 2
- Hardware virtualization: <checked> Expose hardware assisted virtualization to the guest OS
- Performance Counters: <checked> Enable virtualized CPU performance counters
- Memory: 12 GB
- New Hard disk: 128 GB
- New Network: <choose VPC subnet>
- Video Card: Specify custom settings
- - Total video memory: 16 MB
- Click NEXT -->

i. Under Ready to complete:
- <Review entered selections>
- Click FINISH


2. Set-up Boot Order:
a. Before first boot, select to enter the EFI setup:
VM --> Actions --> Edit Settings... --> VM Options (tab) -->
- Force EFI setup: <checked> During the next boot, force entry into the EFI setup screen
- Click OK (button)

b. In the EFI BIOS:
- Change to the boot order
- Use the arrow keys and the plus (+) and minus (-) keys to change the order to your preformed boot order (network first or CD/DVD first, then disk, etc.)
- Exit and save

c. If using CD/DVD, set the CD to CentOS-Stream ISO:
- e.g. vSphere client --> Storage --> NASISO1 --> CentOS-Stream-9-latest-x86_64-dvd1.iso


3. Install CentOS Stream:
a Starting install:
- At boot prompt, choose Install CentOS Stream

b. On the configuration page:
- Click Root Password (near bottom)
- - Set password and confirm
- - Click Done
- Click User Creation (near bottom below Root Password option)
- - Full name: myadminid
- - Username: myadminid
- - Make this user administrator: <checked>
- - Password: <enterpassword>
- - Confirm password: <enterpassword>
- - Click Done
- Click Installation Destination (near top right)
- - <check> Local Standard Disks (e.g. sda)
- - <leave-checked> Automatic
- - Click Done
- Perform Software Selection (middle)
- - <Customize selection as desired>
- - Click Done
- Click Begin Installation

c. Wait for install


4. Perform Prerequisites:
a. Setup network as needed (top right corner if GUI installed)

b. Update system:
Note: bridge-utils is no longer installed (deprecated) and qemu-kvm will be installed with libvirt

- Terminal -->
$ sudo dnf update
<approve and wait>

$ sudo dnf install libvirt NetworkManager
<approve and wait>

$ cd ~/
$ pwd
/home/myadminid
$ mkdir tmp
$ cd tmp
$ wget <url-above> e.g. mirror.openshift.com/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz
<wait a few seconds>
$ tar xvf crc-linux-amd64.tar.xz
<wait a couple seconds>
$ mv ./crc-linux-amd64.tar.xz/crc /usr/local/bin/


5. Perform Installation:
Note: Install is NOT run with root/sudo, but as the admin user (e.g. myadminid)
a. If this is not a a new install, delete the current version first
$ crc delete
<approve and wait>

b. Install:
Note:
- OKD is not the default preset. OpenShift is the default
- - If setting-up OKD, enter the following command before crc setup
- - If setting-up OpenShift, skip to the next crc setup command
$ cd ~/tmp/
$ crc config set preset okd
<wait>

$ cd ~/tmp/
$ crc setup
<watch and wait>

c. Assuming no errors, start the new CRC instance:
Note:
- First start will easily take 15 minutes or more with VM creation, creating the kubelet client cert, the kube-apiserver, and waiting on okd instance, and finally for the operators
- Note the OKD/OpenShift URL and the kubeadmin and developer passwords.

$ crc start
<wait, if OpenShift, provide the pull secret at the prompt>

- Again, note the URL and kubeadmin and developer logins
e.g. console-openshift-console.apps-crc.testing

d. Print the oc add to $PATH command:
$ crc oc-env
<view output and enter>
e.g. export PATH="/home/myadminid/.crc/bin/oc:$PATH" ... eval $(crc oc-env)
$ export PATH="/home/myadminid/.crc/bin/oc:$PATH"
$ eval $(crc oc-env)

e. Get the oc login command to login as a regular user or administrative user:
$ crc console --credentials
<confirm API URL and accounts>
e.g. api.crc.testing:6443

f. Try out the API:
$ oc login -u developer <api-url-above>
- Use insecure connections: y
- Password: developer
<answer above prompts and confirm Login successful message>

$ oc whoami
developer

g1. If running OpenShift (not OKD), verify the Operators are running using oc:
$ oc login -u kubeadmin <api-url-above>
<confirm Login successful>

$ oc config use-context crc-admin
$ oc get co
<view list of operators, confirm available and not degraded>

g2: If running OKD, verify the Operators are running using oc:
$ oc login -u kubeadmin <api-url-above>
<confirm Login successful>

$ oc get co
<view list of operators, confirm available and not degraded>

h. Confirm the single node is Ready:
$ oc get nodes
NAME STATUS ROLES AGE VERSION
crc Ready control-plane,master,worker 90d v1.34.4

Note:
- The age will not be the real 15 mins or so, it will list as 90d


Note:
- Could also do w/in the OpenShift/OKD web console UI (console-openshift-console.apps-crc.testing)
- okd web console --> login --> Administration (left menu) --> Cluster Settings (left menu option) --> ClusterOperators (tab)


---

Issue:
/home not big enough because out-of-disk space during the qcow extraction.


Solution:
Extend the disk of the VM, or if physical, add another disk and add to the LVM, and finally grow the filesystem.


Steps:
1. Extend disk in vSphere or oVirt

2. Extend the partition in the VM using gparted
a. If not installed:
$ sudo dnf install epel-release
<confirm and wait>
$ sudo dnf install gparted
<confirm and wait>

b. Launch gparted:
$ sudo gparted
- Select /dev/sda3
- Right-click, choose Resize/Move
- Drag to use all/the the extent (end added)
- Click the Green Check to apply
- GParted (top menu) --> Quit

c. Extend:
$ lvextend /dev/cs/home /dev/sda3
<view and confirm additional blocks added>
$ xfs_growfs /dev/cs/home
<view and confirm extended>
$ df -h
<confirm increased>


previous page

×