search cancel

Often used OpenShift commands when DX Operation Intelligence debug

book

Article ID: 188429

calendar_today

Updated On:

Products

DX Operational Intelligence

Issue/Introduction

This is a collection of OpenShift commands often used for DX Operational Intelligence debugging.

Environment

OpenShift: 3.x

Resolution

Fundamental  OpenShift command format:
oc [ get | describe ] resource (resource name)

Note:
*1 GET is a summary and DESCRIBE outputs detailed information.
*2 RESOURCE NAME is an option used when want to filter the output results. 
*3 Many of the OC commands are parameter compatible with Kubernetes KUBECTL command.


Examples:

When you do not know the resource type :
# oc get all
You can see the general overview all resources.


Node lists:

# oc get nodes

NAME                          STATUS    ROLES     AGE       VERSION

openshift1.my.net   Ready     master    29d       v1.9.1+a0ce1bc657

openshift2.my.net   Ready     compute   29d       v1.9.1+a0ce1bc657

openshift3.my.net   Ready     compute   29d       v1.9.1+a0ce1bc657


Pods lists (various output formats):

# oc get pods

NAME                                  READY     STATUS     RESTARTS   AGE

adminui-5-ctd56                       1/1       Running    1          23h
(omit later)

# oc get pods --all-namespaces

NAMESPACE                           NAME                                  READY     STATUS             RESTARTS   AGE

doiproject                          adminui-5-ctd56                       1/1       Running            1          23h
(omit later)

# oc get pods --all-namespaces -o wide

NAMESPACE                           NAME                                  READY     STATUS             RESTARTS   AGE       IP             NODE

doiproject                          adminui-5-ctd56                       1/1       Running            1          23h       10.130.1.132   openshift1.my.net
(omit later)



Pod log:

# oc logs elasticsearch-13-5ctkj

* The RESOURCE NAME does not recognize wild-card character. To find the exact Pod name, use GREP as follows:

# oc get pods | grep elasticsearch

elasticsearch-13-5ctkj                1/1       Running    1          23h

# oc get pods elasticsearch-13-5ctkj

NAME                     READY     STATUS    RESTARTS   AGE

elasticsearch-13-5ctkj   1/1       Running   1          23h

Additional Information

Note:  Before executing these commands, login OpenShift with the administrator privileged user such as "oc login -u system:admin".