liveBook · Manning

Oc

As explained in Quarkus in Action

oc is the OpenShift command-line client for authenticating to clusters and managing OpenShift resources.

`oc` is the local command-line client for connecting to an OpenShift cluster and managing its resources. Install its executable before working with OpenShift Sandbox or OpenShift Local. In Sandbox, download the binary from the web console and place it on an executable path. section 11.3.4 section 11.6.1

A practical deployment workflow is:

  • Copy the cluster-specific `oc login` command from your OpenShift profile and run it locally. Sandbox provides a token and server address for the command. section 11.6.1
  • Apply a generated OpenShift manifest with `oc apply -f inventory-service/target/kubernetes/openshift.yml`, or apply an infrastructure manifest to create multiple services in one step. section 11.3.4 section 11.6.2
  • Check `oc get pods` for workload status and `oc get routes` for public addresses. Use `oc whoami --show-console` to find the web console. section 11.3.4
  • Remove resources defined in a manifest with `oc delete -f <manifest>`. Prefer this to `oc delete all --all` when the manifest includes ConfigMaps: the latter does not remove them. section 11.6.2
$ oc login --token=TOKEN --server=SERVER
Logged into "SERVER" as "<username>" using the token provided.

The login command connects the local client to the Sandbox cluster using the token and server address supplied by the console. section 11.6.1

Deploying the car rental infrastructure

Run `oc apply -f car-rental/car-rental-dependent-services.yml` to create the dependent services, then inspect the running containers in the OpenShift console. To remove the resources defined there, run `oc delete -f car-rental/car-rental-dependent-services.yml`. When configuring application-to-application URLs, use OpenShift Service names rather than `localhost`; use `oc get routes` to find a public route needed by browser-facing authentication. section 11.6.2 section 11.6.3

How Quarkus in Action covers it

How deep it goes
Works through login, manifest application, resource inspection, and deletion, including a ConfigMap cleanup caveat; does not provide a command reference.
Examples
Uses token-based Sandbox login, Inventory service checks, and car rental infrastructure apply/delete commands.
What it assumes
Assumes access to an OpenShift cluster and a local terminal; shows how to obtain the client and Sandbox login command.
What you can do after
Operate/configure it to log in, deploy manifests, inspect Pods and Routes, and remove manifest-defined resources.
How it connects
Links OpenShift Sandbox, Kubernetes manifests, Pods, Routes, Services, and ConfigMaps through deployment and inspection commands.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.