Skip to content

CLI reference

The platform is driven with oc, the OpenShift CLI. There is no bespoke GRN CLI to install.

oc is a superset of kubectl — every kubectl command works under oc, plus the OpenShift-specific ones. These docs use oc throughout, and so do the GRN cluster repositories.

Tool What it is for
oc The primary CLI — workloads, projects, routes, RBAC, oc adm
virtctl Virtual machine operations — console, VNC, start/stop, image upload
helm Standard charts, no platform-specific packaging
argocd GitOps reconciliation, when you drive Argo CD from a terminal

Installation instructions are in Access the platform.

Everyday commands

# Where am I?
oc whoami
oc project
oc config current-context

# What exists here?
oc get all -n <project>
oc get pvc,secret,networkpolicy -n <project>

# What went wrong?
oc get events -n <project> --sort-by=.lastTimestamp
oc describe pod <pod> -n <project>
oc logs <pod> -n <project> --previous     # logs from the crashed instance

Projects

oc new-project <project>
oc project <project>                      # switch
oc get projects

Virtual machines

virtctl start <vm> -n <project>
virtctl console <vm> -n <project>
virtctl stop <vm> -n <project>
oc get vmi -n <project> -o wide           # running instances and their IPs

Applying manifests

oc apply -f manifest.yaml -n <project>
oc apply -k .                             # a kustomization directory
oc diff -f manifest.yaml -n <project>     # what would change, before it changes

Run oc diff before oc apply on manifests you did not just write

oc diff reads the live object and shows what the apply would alter, without altering it.

Administration

oc adm policy add-role-to-user edit <user> -n <project>
oc adm top nodes
oc adm top pods -n <project>