How to login?
oc login https://api.XXXXXXXXXXXXXX.centralindia.aroapp.io:6443 --username=kubeadmin --password=EgzIY-DJPw2-3NXke-HNYmJ
oc login --token=sha256~LLnTlPcjcNjWsQRqnSyTn99LSvxwQdm47gaiEdZJa20 --server=https://api.XXXXXXXXXXXXXX.centralindia.aroapp.io:6443
curl -H "Authorization: Bearer sha256~LLnTlPcjcNjWsQRqnSyTn99LSvxwQdm47gaiEdZJa20" "https://api.XXXXXXXXXXXXXX.centralindia.aroapp.io:6443/apis/user.openshift.io/v1/users/~

Login to the Web Console and CLI on CRC
crc console --credentials
eval $(crc oc-env)
oc login -u kubeadmin -p <password> --insecure-skip-tls-verify
Copy the admin URL and kubeadmin
credentials β open in browser.
Step 2: Understand Projects (Namespaces)
List All Projects:
oc get projects
Create Your Own:
oc new-project demo-app
Step 3: Deploy Your First Application
oc get images
oc new-app --name=my-java-app registry.access.redhat.com/ubi8/openjdk-8-runtime@sha256:00cf28cf9a6c427962f922855a6cc32692c760764ce2ce7411cf605dd510367f
oc expose svc/my-java-app
oc get imagestreams -n openshift
oc new-app --name=my-httpd --image-stream=openshift/httpd
oc expose svc/my-httpd
oc get route my-httpd
Test in browser using the exposed route.
Step 4: Work with the Developer Console
- Go to the Web Console β Developer View
- Switch to
demo-app
project - Click +Add β Use βContainer Imageβ
- Search for image like
node:latest
,php:8.2-apache
, orquay.io/...
This gives visual understanding of how apps, builds, and deployments connect.
Step 5: Build from Source (Git to Deployment)
Deploy from Git (Node.js example):
oc new-app https://github.com/sclorg/nodejs-ex.git
Monitor:
oc get builds
oc logs -f bc/nodejs-ex
Access:
oc expose svc/nodejs-ex
oc get route
Step 6: Scale Applications
Increase Pods:
oc scale --replicas=3 deployment/nginx
Check Pods:
oc get pods -o wide
Step 7: Access Pod Shell & Logs
oc rsh <pod-name>
oc logs <pod-name>
Use this for debugging and viewing container state.
Step 8: Set Resource Limits
oc set resources deployment nginx \
--limits=cpu=500m,memory=256Mi \
--requests=cpu=200m,memory=128Mi
Step 9: Understand and Apply YAML
- Export a deployment:
oc get deployment nginx -o yaml > nginx.yaml
- Edit and apply:
oc apply -f nginx.yaml
Step 10: Use Secrets and ConfigMaps
Create ConfigMap:
oc create configmap app-config --from-literal=ENV=prod
Create Secret:
oc create secret generic app-secret --from-literal=DB_PASS=admin123
Mount or Inject via ENV in deployment YAML.
Step 11: OpenShift Pipelines (Tekton)
- In OperatorHub, install OpenShift Pipelines Operator
- Create:
- PipelineResource
- Task
- Pipeline
- Use the developer consoleβs Pipelines view to build CI/CD
Step 12: Monitor with Web UI
- Use Observe β Metrics
- View Dashboard, Topology, and Builds
- Use Pod terminal from console
Step 13: Delete a Project
oc delete project demo-app
Bonus Tips:
Feature | CLI Command |
---|---|
List all Pods | oc get pods |
View events | oc get events |
Port Forward | oc port-forward svc/nginx 8080:80 |
RoleBinding | oc adm policy add-role-to-user admin developer |
Enable Dev View | Use toggle in OpenShift console UI |
Practice Ideas:
- Deploy a multi-container app with
mysql
+wordpress
- Create blue-green deployments
- Use Tekton pipeline to auto-deploy from GitHub
To deploy an image in OpenShift using the openshift/httpd
image, and configure different Kubernetes resources such as StatefulSets, Secrets, ConfigMaps, CronJobs, Jobs, DaemonSets, and HPA, here are the YAML configurations and relevant commands for each.
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd-deployment
spec:
replicas: 1
selector:
matchLabels:
app: httpd
template:
metadata:
labels:
app: httpd
spec:
containers:
- name: httpd
image: openshift/httpd
ports:
- containerPort: 80
Command to deploy:
oc apply -f httpd-deployment.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: httpd-statefulset
spec:
serviceName: "httpd"
replicas: 3
selector:
matchLabels:
app: httpd
template:
metadata:
labels:
app: httpd
spec:
containers:
- name: httpd
image: openshift/httpd
ports:
- containerPort: 80
Command to deploy:
oc apply -f httpd-statefulset.yaml
apiVersion: v1
kind: Secret
metadata:
name: httpd-secret
type: Opaque
data:
password: cGFzc3dvcmQ= # base64 encoded password
Command to create a secret:
oc apply -f httpd-secret.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: httpd-config
data:
httpd.conf: |
ServerName localhost
DocumentRoot /var/www/html
Command to create a config map:
oc apply -f httpd-config.yaml
apiVersion: batch/v1
kind: CronJob
metadata:
name: httpd-cronjob
spec:
schedule: "*/5 * * * *" # Every 5 minutes
jobTemplate:
spec:
template:
spec:
containers:
- name: httpd
image: openshift/httpd
restartPolicy: OnFailure
Command to deploy a cron job:
oc apply -f httpd-cronjob.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: httpd-job
spec:
template:
spec:
containers:
- name: httpd
image: openshift/httpd
restartPolicy: Never
Command to deploy a job:
oc apply -f httpd-job.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: httpd-daemonset
spec:
selector:
matchLabels:
app: httpd
template:
metadata:
labels:
app: httpd
spec:
containers:
- name: httpd
image: openshift/httpd
ports:
- containerPort: 80
Command to deploy a daemon set:
oc apply -f httpd-daemonset.yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: httpd-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: httpd-deployment
minReplicas: 1
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
Command to deploy HPA:
oc apply -f httpd-hpa.yaml
To deploy each of the above resources, use the following commands:
-
Deployment:
oc apply -f httpd-deployment.yaml
-
StatefulSet:
oc apply -f httpd-statefulset.yaml
-
Secrets:
oc apply -f httpd-secret.yaml
-
ConfigMap:
oc apply -f httpd-config.yaml
-
CronJob:
oc apply -f httpd-cronjob.yaml
-
Job:
oc apply -f httpd-job.yaml
-
DaemonSet:
oc apply -f httpd-daemonset.yaml
-
Horizontal Pod Autoscaler:
oc apply -f httpd-hpa.yaml
These YAML files and commands cover the most common Kubernetes resources you may need while deploying an image on OpenShift. Adjust the values (e.g., replicas
, resources
, image
, etc.) as needed for your use case.
Iβm a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Do you want to learn Quantum Computing?
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND