OpenShift CLI Client Installation


Note: These steps are only needed if you are needing to use CloudSpaces for CSXL development due to Docker failing to run properly on your host machine. If you are using Docker and DevContainers, as typically expected, you do not need to follow these instructions.

Install OpenShift CLI Client on your Host Machine

Once you are logged in to Carolina CloudApps, navigate to the Command Line Tools download page: https://console.apps.cloudapps.unc.edu/command-line-tools

The following is primarily an excerise in system administration fundamentals. While not a programming skill, becoming comfortable with the actions and ideas you will need to take in order to install a plain-old binary program on your system is an important rite of passage.

These actions will be taking place on your host machine (e.g. macOS or Windows) and not your dev container.

From the downloads page, you will download a zip file containing the oc CLI program for your computer. You will need to install this program in a directory somewhere on your host machine included in your $PATH list of directories. This concept of adding a binary program (or script) to somewhere on a machine’s $PATH is an important one to understand as a software engineer.

As a brief reminder, the $PATH environment variable contains a list of all directories that will be scanned, in order, looking for a program to run. When you type python3 -m pip, for example, the directories listed in the $PATH will be checked until a program named python3 is found and that is how it is decided for it to be used as the executable in your command.

From a bash or zsh terminal on your host machine (not your DevContainer’s in VSCode!) try running echo $PATH to see a list of directories. On Mac, you will likely see /usr/local/bin as one of the entries. On Windows, you will see a path including a directory with Program Files in the name. Use the mv command-line utility to move the oc binary file (oc.exe on Windows). After successfully doing so, you should be able to run the command oc and see some output starting with “OpenShift Client”. On Mac, if you do not have permission to mv the file to the given directory, try prefixing the command with sudo which will attempt to run the command as an administrator of the computer.

If, on Mac, you see a pop-up indicating a program cannot be run unsafely, you will need to open your system’s Privacy and Security settings, scroll down to the Security section, select the radio option “Allow applications downloaded from App Store and identified developers” and look for a button regarding giving permission to the program ‘oc’ to run. You will need to give this permission and then try running oc again.

Contributor(s): Kris Jordan