OpenShift

 

Command Description
CREATE PROJECT
oc whoami Examine user session
oc login -u username -p p@ssword log in as a different user
oc new-project MY-NEW-PROJECT –display-name=”My New  Example Project” –description=”A new project” Create a project to contain applications
oc project Confirmation that the project was successfully created and verify how many project do you have
oc get all Confirm there are no objects in your project
oc project MY-NEW-PROJECT use the MY-NEW-PROJECT project
CREATE APPLICATION
oc new-app https://github.com/openshift/ruby-hello-world –name=’my-ruby-hello-world’ –labels=”environment=dev” Create an application from a remote repository
oc status Status of deployment
oc get all Examine all of the major objects in project
oc describe buildconfig my-ruby-hello-world Examine the project’s build configuration
oc describe build my-ruby-hello-world-1 Examine the build object
oc describe imagestream my-ruby-hello-world Examine the image streams
oc describe deploymentconfig my-ruby-hello-world Examine the deployment configuration, which manages the creation of replication controllers and pods
oc describe replicationcontroller my-ruby-hello-world-1 Examine the replication controller, which sets and maintains how many pods are to be deployed:
oc describe svc my-ruby-hello-world Examine the service, which directs access to all of the pods from a single IP address:
oc logs my-ruby-hello-world-1-build Examine the logs of the builder pod
EXPOSE ROUTE TO APPLICATION
oc expose svc my-ruby-hello-world Enable web access to application
oc get route Find the route
oc describe route my-ruby-hello-world Describe the route
SCALE UP APPLICATION
oc get pods Determine the number of pods you have in the ruby-hello-world project (namespace)
oc scale –replicas=3 deploymentconfig my-ruby-hello-world Scale up the number of pods to 3
oc describe replicationcontroller my-ruby-hello-world-1 Describe the replication controller
oc get pods -o wide Determine which nodes have which pods
oc describe svc my-ruby-hello-world Examine the service,
LAUNCH APPLICATION FROM LOCAL COPY
oc new-project Create a project to contain applications
git clone https://github.com/<yourname>/ruby-hello-world Clone this repository
cd ruby-hello-world/ Change to the ruby-hello-world directory
oc new-app . –docker-image=registry.access.redhat.com/rhscl/ruby-23-rhel7 Create an application in the local repository:
oc logs -f ruby-hello-world-1-build View the build log