🔴 What is oc?¶
oc is the OpenShift CLI tool (similar to kubectl but with OpenShift features).
It allows you to:
- Login to cluster
- Deploy apps
- Create projects
- Manage routes
- Scale deployments
- Debug pods
✅ Step 1: Check if Chocolatey is Installed¶
Open PowerShell as Administrator and run:
If version shows → good.
If not installed, install Chocolatey first:
Set-ExecutionPolicy Bypass -Scope Process -Force; `
[System.Net.ServicePointManager]::SecurityProtocol = `
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Restart PowerShell after installation.
✅ Step 2: Install OpenShift CLI (oc)¶
Run:
Wait for installation to complete.
✅ Step 3: Verify Installation¶
If installed correctly, you’ll see:
✅ Step 4: Login to Your Sandbox¶
Since you're already using OpenShift Sandbox:
- Go to your OpenShift web console
- Click top right → your username
- Click Copy Login Command
- Choose
oc - Copy the command
It will look like:
Paste in PowerShell.
✅ Step 5: Test Commands¶
🔥 Pro Tip (DevOps Style)¶
Add this alias for easier typing:
Now you can use:
🧠 How oc is Different from kubectl¶
| kubectl | oc |
|---|---|
| Kubernetes CLI | OpenShift CLI |
| Generic K8s | OpenShift specific features |
| No project command | oc new-project |
| No build configs | Supports BuildConfig |
OpenShift CLI is built on top of Kubernetes CLI.