Oc get: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 67: Line 67:


==events==
==events==
Lists [[OpenShift_Concepts#Events|events]].


  oc get events [-n ''<project-name>'']
  oc get events [-n ''<project-name>'']

Revision as of 17:06, 6 July 2017

External

Internal

Overview

Gets all resources of a certain type or a single resource of a certain type if specified by name.

Namespace Selection

Generic oc namespace selection applies.

Additionally, to specify all projects, use:

oc get --all-namespaces ...

Selectors

Selectors can be applied with the "-l" option:

oc get ... -l 'label_name=label_value'

Output

JSON Output

oc get ... -o json

YAML Output

oc get ... -o yaml

-o template

-o template --template '{{.status.podIP}}{{"\n"}}'

Example:

oc get node infranode1 -o template --template '{{.spec.externalID}}{{"\n"}}'
infranode1

Subcommands

all

oc get all [-n <project-name>]

bc

Returns the Build Config.

oc get bc

returns all build configs from the current project.

oc get bc my-build-config

returns the specified build config.

builds

oc get builds

events

Lists events.

oc get events [-n <project-name>]

identity

Returns information about user identity.

oc get identity

namespaces

netnamespaces

Displays the virtual networks assigned to each project. See OpenShift Network Plugins.

oc get netnamespaces
NAME               NETID
default            0
kube-system        11092823
logging            6208947
management-infra   5562275
openshift          8714409
openshift-infra    13183382
pizzaparty-dev     5721085
playground         7804116

node

Describes an individual node:

oc get node <node-name>

nodes

Displays all nodes:

oc get nodes [-n <project-name>]

pods

oc get pods --all-namespaces

projects

project

oc get project logging -o yaml

sa

Returns the service accounts.

oc get sa

scc

oc get scc

se

oc get se docker-registry

status

oc get status

builds

Get the builds and their status.

quota

For the current project:

oc get quota

For an arbitrary project:

oc get quota -n <project-name>

routes

oc get routes

pv

pvc

event

clusternetwork

Information about the network plugin and network status.

See

OpenShift Network Plugins

users

Returns the regular users on the system. As "system:admin":

oc get users
NAME      UID                                    FULL NAME   IDENTITIES 
ovidiu    788f943e-610c-11e7-9dee-525400863964               htpasswd_auth:ovidiu