Table of Contents
Red Hat OpenShift is a Kubernetes distribution used for developing and deploying applications. Red Hat OpenShift is used by major organization and is considered as one of the skills to get hired in these companies. For getting knowledge on OpenShift, we should have an enviornment to play around with. In this article, we will see how to install a container Ready Openshift in your Laptop for development and testing (not for production).
Install Red Hat OpenShift Local
Pre-Requisites
- The system installed with windows 10
- RAM in the machine should be 16 GB
- Virtualization should be enabled
- Hyper-V should be installed (If not installed, during the setup it will get automatically installed)
- Disk space of 50 GB
- Redhat Account (free)
Download Exec file and secret
- We need to download the exec file and secret for the installation
- Go to redhat console
- Enter the login details in the Redirected SSO page
- Once logged in , Navigate to Clusters and Click on Create Cluster
- Navigate to Local and Download OpenShift Local and download the pull secret
- We will be getting a archive file which needs to be extracted
Install the executable binary
Navigate to the extracted folder, and start the installation. Below section contains the screen when user interaction is required, some screens where user interaction is not required will be seen which i have not included below, that user can read and proceed by clicking Next
Accept Terms & Conditions
Select Installation path
It is preferred to chose the default drive, in my setup it is C drive
Finish the Setup
Restart the Machine
You will be asked to restart the machine Now or Later. Its better to restart the machine while the restart screen is seen
Configure OS to run Redhat OpenShift
We need to configure the OS to run the Redhat OpenShift. This can be done by running the executable file which we have installed in the previous step
Choose Preset
After the welcome screen, we will be asked to select the Preset, as openshift or podman. For the sake of this article, i will be choosing openshift.
Provide Pull secret
We need to provide the pull secret, which we downloaded along with the archive file
Start the Setup
Start the setup, clicking on Run Setup. You can opt in/out for sending data to the Redhat
Wait for the Installation to complete
- We need to wait for the installation to complete. This may take from 5 min to 1 hr based on your setup and internet speed. As in the backend it is downloading a file of size 3GB
- Once the installation is complete, Reboot the machine
Verify Installation
- Start the OpenShift Local application which is now installed in the machine
- Navigate to system tray ( bottom right side of the screen) and click on the openshift icon, you can see the status of the cluster.
- Just after the installation, we will seeing the status as Starting, and we can view the console logs for the same
- Logs can be viewed by clicking on Open logs. Below snippet shows the logs, while the status was in starting
- It will take a minute or two to start
Final configuration and Checks
Set Env variable
- Once the setup is started, open power shell and execute crc oc-env
- This will show the crc path, and the command to add this in the PATH variable of the system
- Below code snippet shows the same
PS C:\Users> crc oc-env $Env:PATH = "C:\Users\*****\.crc\bin\oc;$Env:PATH" # Run this command to configure your shell: # & crc oc-env | Invoke-Expression PS C:\Users> $Env:PATH = "C:\Users\*****\.crc\bin\oc;$Env:PATH"
Verify oc command
Once the env variable is set, we can verify the oc commands, below snippet shows the successful execution of the commands
PS C:\Users\*****> oc get nodes NAME STATUS ROLES AGE VERSION crc-lgph7-master-0 Ready master,worker 12d v1.24.0+3882f8f PS C:\Users\*****> oc get ns NAME STATUS AGE default Active 12d kube-node-lease Active 12d kube-public Active 12d kube-system Active 12d
Fetch credentials and Login to console
- Credentials for logging to the openshift setup can be fetched from the power shell
- Below code snippet shows the command and the output for the same
PS C:\Users> crc console --credentials To login as a regular user, run 'oc login -u developer -p developer https://api.crc.testing:6443'. To login as an admin, run 'oc login -u kubeadmin -p 8TPH3-LzmN9-MC79F-gZBks https://api.crc.testing:6443'
- We can use the above credentials to login to the openshift console
- Below screen shot shows the console screen after login
Common Errors
Below are the common error seen during the installation
- md5 check sum validation failed :
- Root Cause: The downloaded executable file and the pull secret are not matching
- Solution: Redownload the executable file and pull secret from the redhat console
- Failure in step Configure OS to run Redhat OpenShift
- oc : The term 'oc' is not recognized error
- Solution : The path variable need to be set. Follow this step to solve this issue