Refer above article for learning on how to install crc openshift on your laptop/desktop
Quick steps –
$ oc new-project ruby-hello-world --description="Ruby Hello World Project" --display-name="Ruby Hello World"
$ oc projects
$ oc project ruby-hello-world
$ oc new-app https://github.com/openshift/ruby-hello-world.git
$ oc get pods
$ oc get all
$ oc projects
Login as developer in openshift
[prayag@openshift ~]$ oc login -u developer
Logged into "https://api.crc.testing:6443" as "developer" using existing credentials.
You don't have any projects. You can try to create a new project, by running
oc new-project <projectname>
Create new ruby hello world project
[prayag@openshift ~]$ oc new-project ruby-hello-world --description="Ruby Hello World Project" --display-name="Ruby Hello World"
Now using project "ruby-hello-world" on server "https://api.crc.testing:6443".
You can add applications to this project with the 'new-app' command. For example, try:
oc new-app rails-postgresql-example
to build a new example application in Ruby. Or use kubectl to deploy a simple Kubernetes application:
kubectl create deployment hello-node --image=k8s.gcr.io/e2e-test-images/agnhost:2.33 -- /agnhost serve-hostname
[prayag@openshift ~]$
Create new app for ruby using github url – https://github.com/openshift/ruby-hello-world.git
[prayag@openshift ~]$ oc project
You have one project on this server: "Ruby Hello World (ruby-hello-world)".
Using project "ruby-hello-world" on server "https://api.crc.testing:6443".
[prayag@openshift ~]$ oc new-app https://github.com/openshift/ruby-hello-world.git
--> Found container image 88b6cf4 (2 weeks old) from registry.access.redhat.com for "registry.access.redhat.com/ubi8/ruby-27"
Ruby 2.7
--------
Ruby 2.7 available as container is a base platform for building and running various Ruby 2.7 applications and frameworks. Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in Perl). It is simple, straight-forward, and extensible.
Tags: builder, ruby, ruby27, ruby-27
* An image stream tag will be created as "ruby-27:latest" that will track the source image
* A Docker build using source code from https://github.com/openshift/ruby-hello-world.git will be created
* The resulting image will be pushed to image stream tag "ruby-hello-world:latest"
* Every time "ruby-27:latest" changes a new build will be triggered
--> Creating resources ...
imagestream.image.openshift.io "ruby-27" created
imagestream.image.openshift.io "ruby-hello-world" created
buildconfig.build.openshift.io "ruby-hello-world" created
deployment.apps "ruby-hello-world" created
service "ruby-hello-world" created
--> Success
Build scheduled, use 'oc logs -f buildconfig/ruby-hello-world' to track its progress.
Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
'oc expose service/ruby-hello-world'
Run 'oc status' to view your app.
[prayag@openshift ~]$
List the pod
[prayag@openshift ~]$ oc get pod
NAME READY STATUS RESTARTS AGE
ruby-hello-world-1-build 0/1 Completed 0 5m50s
ruby-hello-world-598f6d995b-567rn 1/1 Running 0 108s
[prayag@openshift ~]$ oc get all
NAME READY STATUS RESTARTS AGE
pod/ruby-hello-world-1-build 0/1 Completed 0 5m55s
pod/ruby-hello-world-598f6d995b-567rn 1/1 Running 0 113s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/ruby-hello-world ClusterIP 10.217.5.1 <none> 8080/TCP 5m57s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/ruby-hello-world 1/1 1 1 5m57s
NAME DESIRED CURRENT READY AGE
replicaset.apps/ruby-hello-world-598f6d995b 1 1 1 114s
replicaset.apps/ruby-hello-world-77966dc655 0 0 0 5m57s
NAME TYPE FROM LATEST
buildconfig.build.openshift.io/ruby-hello-world Docker Git 1
NAME TYPE FROM STATUS STARTED DURATION
build.build.openshift.io/ruby-hello-world-1 Docker Git@0c607af Complete 5 minutes ago 4m5s
NAME IMAGE REPOSITORY TAGS UPDATED
imagestream.image.openshift.io/ruby-27 default-route-openshift-image-registry.apps-crc.testing/ruby-hello-world/ruby-27 latest 5 minutes ago
imagestream.image.openshift.io/ruby-hello-world default-route-openshift-image-registry.apps-crc.testing/ruby-hello-world/ruby-hello-world latest About a minute ago
[prayag@openshift ~]$
Get the project details
[prayag@openshift ~]$ oc get projects
NAME DISPLAY NAME STATUS
ruby-hello-world Ruby Hello World Active
[prayag@openshift ~]$
I hope you found this article to be useful in some way. I’ll be back with some more interesting new DevOps articles soon.