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
Important:
- If you are not going to use automatic partitioning, where the /home folder is part of the main root / folder, set the disk size to 128 GB.
- If you are using automatic partitioning, where the /home folder is separate in the LV, set the disk size between 48 to 64 GB. Skip to the bottom of this document to Extend the /Home Folder before doing Step 5: Installation.
- If you are actually skipping this section because you are deploying a CentOS Stream image in oVirt/RHV or vSphere, the /home folder will also be too small, perform the Extend the /Home Folder before doing Step 5:Installation, as well.
Installation 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:
Important:
- Review the disk size depending on the /home folder logistics
Complete the following fields:
- 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: 64 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:
Important:
- If you are not going to expand the /home directory, do not choose automatic, but manually set-up w/o a separate /home in the LVM
- 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:
Notes:
- bridge-utils is no longer installed (deprecated) and qemu-kvm will be installed with libvirt
- git (which will likely install git-core) is required in order to deploy images via git
- Terminal -->
$ sudo dnf update
<approve and wait>
$ sudo dnf install libvirt NetworkManager git git-core
<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 cluster first
$ crc delete
<approve and wait>
b. Install:
$ cd ~/tmp/
Presets Notes:
- Multiple cluster types possible: OpenShift, OKD, and Microshift (smaller resources usage)
- - openshift preset is the default on Linux
- - If setting-up OpenShift, either skip entering a preset if on Linux, or use the openshift preset command below
- - If setting-up OKD, enter the okd preset command below before the crc setup command
- Resources:
- - openshift: 4 CPU / 10.5 GB mem / 35 GB Disk
- - okd: 4 CPU / 10.5 GB mem / 35 GB disk
- - microshift: 2 CPU / 4 GB mem / 35 GB disk
- Web Console is available for openshift and okd presets, but not the microshift one
- Only if VM/workstation has minimal 14 GB, optional to enable cluster monitoring (see below). In our testing, even with 24 GB, CRC reported having only 10.5GiB. We had to use the crc start memory variable (see further below).
$ crc config set preset openshift
<wait>
or
$ crc config set preset okd
<wait>
or
$ crc config set preset microshift
<wait>
$ crc config set enable-cluster-monitoring true
<wait>
Setup Notes:
- The first time crc setup is run it creates a hidden ~/.crc folder
- Even if your workstation/laptop/vm has 24 GB of RAM, the OS may still not give CRC 14 GB, and you may see the error: ERRO Too little memory (10.5Gib) ... when you are a VM with 20 GB.
$ cd ~/tmp/
$ crc setup
<watch and wait>
c. Assuming no errors, start the new CRC instance:
Notes:
- First start will easily take 15 minutes or more with virtual instance creation, creating the kubelet client cert, the kube-apiserver, and waiting on okd instance, and finally for the operators
- The crc start command prints the OKD/OpenShift URL and the kubeadmin and developer passwords
- To view the developer login password afterwards, use the crc console --credentials command
$ 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. Set-up oc via the oc-env $PATH command:
Notes:
- Enter both the export and the eval commands to setup oc.
- We do not have to download oc separately; it is included with the crc setup
$ 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. Run the Web Console (assuming not microshift)
- Get the logins again via:
$ crc console --credentials
<confirm API URL and accounts>
e.g. api.crc.testing:6443
- Run with default browser:
$ crc console
<wait for browser to open to site>
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
g. Verify Operators:
Note:
- By default, crc disables the Cluster Monitoring Operator
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 whoami
<view output - confirm = kubeadmin>
$ 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
Notes:
- The age will not be the real time, 15 mins or so, it will list as 90d
- Could also verify status 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) --> confirm Available (Ready)
6. Deploy test application:
a. Deploy an app:
$ oc create deployment hello-world --image=registry.access.redhat.com/ubi8/httpd-24
$ oc expose deployment hello-world --type=NodePort --port=8080
$ oc expose svc/hello-world
b. Wait and verify running:
$ oc get pods
<wait/verify till Running>
c. Get route (URL) for external access on the local network, and test:
$ oc get route
<view the URL under the HOST/PORT column>
$ curl http://hello-world-default.apps-crc.testing
<view http welcome page>
Notes:
- hello-world is the name of the deployment pod
- default is the default namespace/project
- apps.crc.testing is the local DNS suffix for the OpenShift Local applications
- crc.testing is the local DNS suffix for the OpenShift services, themselves
- CoreDNS is the OpenShift service providing the local DNS resolution
---
Extend the /home Folder Task
Overview:
Reducing the root / folder is more risky after installation. If using automatic partitioning, which happens when we deploy images via automation, a good course of action to keep the shared LVM for /home and root / small. e.g. (32 GB to 64 GB), and then perform the disk expansion after the deployment, this way /home gets all the increase.
Issue:
If using automatic partitioning,/home not big enough because out-of-disk space during the CRC/OpenShift Local qcow extraction.
Solution 1:
Don't use automatic partitioning. Manually set-up with out the LVM for /, /home, and the others. Set a large disk size on creation.
Solution 2:
After the CentOS Stream installation, extend the disk of the VM, or if physical, add another disk and add to the LVM and grow the filesystem.
Steps:
1. Extend disk in vSphere or oVirt
e.g. vSphere --> login --> navigate to VM --> Actions --> Edit Settings ... --> increase Disk 1 size
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:
$ sudo lvextend /dev/cs/home /dev/sda3
<view and confirm additional blocks added>
$ sudo xfs_growfs /dev/cs/home
<view and confirm extended>
If fails because home is not mounted (e.g. running w/GPARTD iso booted):
$ sudo mount /dev/cs/home /home
$ sudo xfs_growfs /dev/cs/home
<view and confirm extended>
$ df -h
<confirm increased>
previous page
|