Spread the love

This page will be dedicated to openshift cluster administrators to get day to day openshift commands handy !

Login on the master with default system admin (super user) access rights.

  • #oc login -u system:admin -n default   

To get all the nodes belongs to Openshift cluster.

  • # oc get nodes

To describe the node configuration ( labels etc.)

  • # oc describe node NODE_NAME-(name of the node you want to describe)

To fetch the list of pods belongs to current project.

  • # oc get pod

To get the pods from specific project/namespace

  • #oc get pod -n PROJECT_NAME

To get the pods with the node details ( on which node pods are running )

  • # oc get pods -o wide

To get all the pods from all the projects ( all pod from complete openshift cluster )

  • # oc get pods –all-namespaces

In order to take backup, before any config modification.

  • # oc export dc DC_NAME >Backup.txt

To get hostsubnet all nodes belongs.

  • # oc get hostsubnet

To get the replication controller.

  • # oc get rc

To get deployment config.

  • # oc get dc

To read the content of any config (in this case DC)

  • # oc get dc hello-openshift -o yaml

To get all important configuration file from project.

  • # oc get all,secret,configmap

To get the list of available Persistent volumes.

  • # oc get pv

To get the persistence volume claims.

  • # oc get pvc

Recent version of openshift run console as internal pod.

  • # oc get pod -n openshift-console

To get only running pod belongs to current project.

  • # oc get pod | grep running

To get the list of pods which still not ready but running.

  • #oc get pod | grep 0/1

Add cluster level permissions to group.

  • #oadm policy add-cluster-role-to-group system-admin group-name

To add cluster level permissions to user

  •  #add-cluster-role-to-user system-admin user-name

To get the security context constraints

  • #oc get scc

To edit the configuration files like DC or RC.

  • #oc edit dc DC_NAME

To check the logs.

  • #oc logs -f pod-name

To check the openshift events

  • #oc get events 

Go inside of a project

  • #oc project Project_name

To get the quota ( resource limit enforced on project)

  • #oc get quota

To get the Limit enforced on the pod

  • #oc get limitrange

To the the router, from which your application will be accessible.

  • #oc get route

To get the service, router will be talking to service and service is talking to pods it attached.

  • #oc get svc

To get the image streams ( image stream = image with different tags)

  • #oc get is

To go inside of a running pod

  • #oc rsh pod-name or docker exec -it pod-name -n project-name bash




Share !

Social menu is not set. You need to create menu and assign it to Social Menu on Menu Settings.