Managing Kubernetes Resources in
OpenShift
1⃣ Overview
As an OpenShift administrator, you must manage the lifecycle of resources — importing,
exporting, and configuring Kubernetes objects such as Deployments, Services, ConfigMaps,
and Secrets.
📥 Importing Resources
Purpose:
Bring existing Kubernetes manifests (YAML or JSON) into your OpenShift cluster.
Command:
oc apply -f <directory_or_file_path>
oc apply -f ./test
Details:
• Creates or updates resources defined in the manifests.
• Works on a single file or an entire directory.
Example:
oc apply -f ./manifests/
For im[portingindividual resorce files by specifying the file path instead of a
directory.
Oc apply -f ./test/service_account.yaml
📤 Exporting Resources
Purpose:
Backup, duplicate, or share resource configurations.
Command:
oc get <resource_type> <resource_name> -o yaml > [Link]
Examples:
This command retrieves the definition of the first app deployment and saves it to a
file named my [Link].
• oc get deployment first-app -o yaml > [Link]
• you can export other types of resources such as services, config maps, or
secrets by replacing
• oc get svc,cm,secret -o yaml
Extracting Secrets/ConfigMaps:
• First list secrets: oc get secrets
• oc extract secret/<secret_name>
• Then extract: oc extract secret/<secret_name> --to=./
o You can also specify a target directory (e.g. /tmp/).
• You can extract the file and send it to another location by appending the path after
tmp.
•
o
⚙ Modifying Resource Configurations
Steps:
nano [Link]
1. Export the YAML file.
2. Open it in a text editor.
3. Change fields (replica count:2, environment variables, hanging service port
mappings.
4. save
5. Apply updated configuration:
oc apply -f [Link]
Note:
If the resource was originally created using oc new-app, you may see a warning when
applying changes.
Check Results:
oc get pods — verify replicas and pod states.
If we do the OC get pods command, we can see that we have two pod replicas
instead of one.
⚖ Declarative vs Imperative Commands
Approach Commands Style Description
Declarative oc apply -f
Desired Define what you want; OpenShift
(Preferred) state figures out how to achieve it.
oc create, oc delete, oc Step-by- You explicitly tell OpenShift
Imperative
patch, oc replace, oc edit step what to do.
Declarative (oc apply)
• Checks if the resource exists:
o If not → creates it.
o If yes → updates only what changed.
• Ideal for Infrastructure as Code (IaC) workflows.
• Great for GitOps and version control.
Imperative Commands
• Execute direct actions manually.
• Useful for quick, one-off operations or troubleshooting.
Immutable Fields
If certain properties cannot be changed, OpenShift shows a warning.
To force the update (⚠ use cautiously):
oc apply --force -f [Link]
🧰 Commonly Used oc Subcommands
Command Description
oc get List or view resources in cluster
oc describe Detailed info about a resource
oc create Create from a file or stdin new resources from yaml json maifest
oc apply Create or update declaratively
oc delete Remove a resource from clustedr
oc edit Edit resources interactively in terminal
oc logs View container logs
oc exec Run a command inside a container
Help Command:
oc -h
🏁 Summary
✅ Import: oc apply -f <file_or_dir>
✅ Export: oc get <type> -o yaml > [Link]
✅ Extract secrets/config maps: oc extract <resource>
✅ Modify configs: Edit YAML → oc apply -f
✅ Prefer declarative (oc apply) for consistency and automation.
✅ Use imperative commands for direct or quick actions.
🧩 Locating and Examining Container Images in
OpenShift
🔹 1. Importance
• As an OpenShift administrator, it’s crucial to know how to find and inspect
container images running in the cluster.
• Helps in managing and troubleshooting applications.
🔹 2. What is a Container Image?
• Defines the application code, dependencies, and runtime environment.
• Every pod is created from one or more container images.
🔹 3. Kubernetes and Image Management
• Kubernetes itself doesn’t manage container images directly.
• It relies on Docker registries or other external registries to store and distribute
images.
🔹 4. OpenShift Image Streams
• OpenShift uses Image Streams instead of raw images.
• An Image Stream is:
o A sequence of pointers to one or more container images.
o Acts as an abstraction layer for easier image management.
o Can be linked to deployments for automatic updates.
• Images can come from:
o Internal registry (built into OpenShift)
o External registries (e.g., [Link], Docker Hub)
🔹 5. Default Image Streams
• When OpenShift is installed, it automatically creates Red Hat–provided image
streams.
• These are available in the openshift project (default global project).
• All users have view access to this project.
🔹 6. Key Commands
Purpose Command Description
List all image oc get imagestreams -n Lists available image streams in the
streams openshift openshift project.
Describe a specific oc describe is imagestream Shows details like labels, annotations,
image stream <name> -n openshift repository, tags, and image IDs.
Get details of a oc describe image Displays metadata — image ID, size,
specific image <image_id> creation time, ports, env vars, etc.
Downloads and extracts image
Extract image oc image extract <image> -
-path /:/local/dir contents to your local system for
contents
inspection.
🔹 7. Inspecting Images
• oc describe provides:
o Docker image ID
o Image size
o Creation date
o Exposed ports
o Environment variables
o Repository source
• oc image extract:
o Extracts file system of the image.
o You can explore configuration files, binaries, and app code locally.
• Another way to examine a container image is to use the OC image Extract
command to download the image
• contents to your local file system.
• Running the OC image extract command will extract the file system contents
of the specified image and
• send them to the target on your local machine once the extraction is
complete.
• Navigate to that directory and explore the images file system.
• Look for configuration files, application code, and other relevant artifacts to
understand how the
• image is structured and what it contains.
• By combining these techniques, such as listing image streams, describing
image and image stream details,
• and extracting image contents for further inspection.
• You can comprehensively understand the container images deployed in your
OpenShift cluster.
• That concludes our lecture on locating and examining container images in
OpenShift.
• Please explore the container images in your cluster and apply the techniques
covered in this demo.
o
🔹 8. Summary
• Use image streams for efficient image management in OpenShift.
• Commands like oc get, oc describe, and oc image extract help in:
o Listing,
o Inspecting, and
o Exploring container images.
• Combining these techniques gives a comprehensive view of how images are used and
structured in your OpenShift cluster.
🔹 9. Next Steps
• Practice the commands in your own OpenShift environment.
• Explore different image streams in the openshift project.
• Next topic: Creating and Deleting Projects in OpenShift.
Notes: Projects in OpenShift
🔹 1. What is a Project in OpenShift?
• A project in OpenShift is a logical unit that organizes and isolates resources within a
cluster.
• Each project contains:
o Deployments
o Pods
o Services
o Routes
o ConfigMaps, etc.
• Projects also enable access control, defining who can access and manage specific
resources.
🔹 2. Purpose of Projects
• Isolation: Keeps different applications and teams separated.
• Organization: Groups related resources under one logical unit.
• Access Control: Determines user permissions within the project.
• Resource Management: Supports quotas and limits per project.
🔹 3. Creating a Project (CLI Method)
✅ Step 1: Login to Cluster
oc login -u developer -p <password> [Link]
✅ Step 2: Create a New Project
oc new-project my-demo-project
• Creates a new project named my-demo-project.
• Automatically switches the CLI context to the new project.
✅
Step 3: Verify the Project
oc projects
• Lists all projects available to the logged-in user.
• The new project should appear in the list.
🔹
✅ 4. Deploying an Application
Step 1: Create a Simple App
oc new-app -–name=my-app –-image-openshift/hello-openshift
• Deploys a simple "Hello OpenShift" application using the provided image.
✅
Step 2: Check Deployment Status
oc get pods
• Shows pod status (e.g., Running, Pending, etc.).
• Wait until the application pod is in the Running state.
✅5. Viewing Project Resources
🔹
Get an Overview of All Resources
oc get all
• Displays all resources in the current project (deployments, pods, services, etc.).
Describe Project Details
✅
oc describe project my-demo-project
• Provides detailed information including:
o Metadata (labels, annotations)
o Resource quotas and limits
o Events and usage stats
🔹 6. Deleting a Project (CLI Method)
oc delete project my-demo-project
• Deletes the project and all associated resources.
• To confirm deletion:
oc projects
• The deleted project will no longer appear.
🟡 Note:
After deletion, the message
“You are not a member of any projects.”
appears — this is normal for a developer user (not a cluster admin).
🔹
✅ 7. Creating a Project (Web Console Method)
Steps:
1. Log in to the OpenShift Web Console as developer.
2. Click Add (top-left corner).
3. Select Projects.
4. Click Create Project.
5. Enter:
o Project Name → my-demo-project
o Optional: Display Name & Description
6. Click Create.
✅ The new project appears in the Developer View.
🔹 8. Deleting a Project (Web Console Method)
1. Go to the Project View.
2. Click the Actions (⋮) dropdown → choose Delete Project.
3. Confirm deletion by typing the project name.
4. Click Delete.
⚠ Caution:
Deleting a project removes all its resources permanently.
🔹 9. Key Takeaways
• Projects are fundamental for:
o Organizing workloads
o Managing access control
o Isolating environments
• You can create, inspect, and delete projects via both the CLI and Web Console.
• Deleting a project cleans up all resources within it.
• Monitoring may be limited in local clusters (like CRC/OpenShift Local).
🔹 10. Summary of Common Commands
Action Command
Login to cluster oc login -u developer
Create project oc new-project my-demo-project
List projects oc projects
Deploy app oc new-app openshift/hello-openshift --name=myapp
View resources oc get all
Describe project oc describe project my-demo-project
Delete project oc delete project my-demo-project
🧩 Notes: Examining Resources and Cluster Status in OpenShift
🔹 1. Importance
• As an OpenShift administrator or developer, understanding your cluster resources
and overall health is essential.
• Helps in monitoring performance, troubleshooting issues, and managing
workloads efficiently.
🔹 2. Basic Resource Examination
Crc console --credentials
✅ Login
oc login -u kubeadmin -p <password> [Link]
✅ Common Commands
Purpose Command Description
Lists deployments in the current
List deployments oc get deployments
project.
oc get pods -n
List pods in <namespace>(openshift-
Views pods in a specified
another namespace apiserver) namespace.
List pods from all oc get pods --all-namespaces Displays pods across the entire
namespaces cluster.
Shows detailed info about a
Describe a oc describe <resource> <name> resource. Inspect abt the state
resource
and detail
🟢 Use oc get and oc describe for any resource type (e.g., pods, services, routes,
deployments, etc.).
🔹 3. Checking Cluster Status
✅
Cluster Overview
oc status
• Gives a summary of:
o Current project
o Services and deployments
o Recent events or warnings
🔹
✅ 4. Node and Control Plane Health
List All Nodes
oc get nodes
• Displays:
o Node names
o Status (Ready, NotReady)
o Roles (master/worker)
✅ o Age and version
Check Control Plane Components
oc get componentstatuses
• Shows health of:
o Scheduler
o etcd
o Controller Manager
• Status indicates whether each component is healthy or facing issues.
🔹 5. The oc adm Command (Administrator Toolkit)
💡 Purpose
• Used for cluster-wide administration and performance monitoring.
• Acts as the "Swiss Army knife" for OpenShift administrators.
• With OC ADM you can manage nodes, control, access and gather important
insights about your clusters
• resource utilization.
• The OC ADM top nodes command is handy when you want to monitor the
resource consumption of your cluster
• nodes.
•
✅
Examples
Task Command Description
Show node oc adm top nodes
Displays CPU & memory
resource usage usage of each node.
Sort nodes by oc adm top nodes --sort-by=cpu
Helps identify high CPU-
CPU usage consuming nodes.
Show pod oc adm top pods
Displays CPU & memory
resource usage usage per pod.
Pod usage by oc adm top pods - Limits view to a specific
namespace namespace=<namespace>(my-namespace) namespace.
You can also use labels to filter the pods you want to see.:oca dm top pods –l
app=app-name
🟡 Note: On OpenShift Local (CRC), monitoring operators are not installed, so metrics may
not appear.
✅ 6. Monitoring via Web Console
🔹
Access the Dashboard
1. Log in as kubeadmin.
2. Go to Home → Overview.
3. Dashboard sections include:
Section Description
Cluster Details Shows cluster ID, provider, OpenShift version.
Cluster Inventory Counts of nodes, pods, storage classes, and PVCs.
Cluster Status Shows health of control plane and operators.
Cluster Utilization Graphs for CPU, memory, and storage trends (requires Prometheus).
Activity Feed Lists recent events, alerts, and cluster changes.
🟡 In OpenShift Local, advanced monitoring (Prometheus dashboards) may be unavailable.
🔹 7. Good Practices
• Check cluster health regularly using oc status and dashboard overview.
• Monitor resource utilization with oc adm top commands.
• Investigate alerts and degraded operators immediately.
• Use labels and namespaces to filter specific workloads for easier management.
🔹 8. Key Commands Summary
Command Purpose
oc get <resource> Lists resources
oc describe <resource> <name> Detailed view of a resource
oc status Overview of current project
oc get nodes View node list and status
oc get componentstatuses Check control plane health
oc adm top nodes View node resource usage
oc adm top pods View pod resource usage
🔹 9. Summary
• oc get and oc describe → Examine resources.
• oc status → Check project overview.
• oc get nodes / oc get componentstatuses → Check cluster health.
• oc adm top → Monitor resource utilization.
• Web Console → Visual monitoring and insights.
• Regular monitoring ensures cluster stability and proactive issue resolution.
🧾 Lesson Notes: Viewing and Analyzing Logs in
OpenShift
1⃣ Introduction
• Logs are essential for troubleshooting, monitoring, and understanding what’s
happening inside your OpenShift cluster.
• They help diagnose issues like crash loops, failed deployments, or permission
errors.
• You’ll use both the CLI (oc logs) and the Web Console to access and analyze logs.
2⃣ Viewing Logs from the CLI
🔹 The oc logs Command
• The main command for retrieving logs of pods, builds, or deployments.
• Syntax help:
• oc logs -h
Displays available options and usage examples.
🔸 Streaming Logs in Real Time
oc logs -f <resource_name>
• The -f (follow) flag streams logs live as they’re generated.
• Commonly used for watching builds and deployments in progress.
Examples:
# Follow logs for the most recent build
oc logs -f bc/<buildconfig_name>
# Follow logs for the latest deployment
oc logs -f deployment/<deployment-name>
🔸 Viewing Specific Versions
If you want logs from a specific version, specify the version number:
# For a specific deployment version
oc logs -deployment/<deployment-name> -version=<version-number>
# For a specific build version
oc logs bc/<build-configname> --version=< version-number>
For example, if you want to see the logs of the first deployment, you would use version equals one.
🔸 Viewing Pod Logs
# Stream a specific pod’s logs
oc logs -f <pod_name>
# Show only the last 10 lines
oc logs -f pod/<pod_name> --tail=10 (oc logs -f pod my-pod--tail=10)
3⃣ Viewing Node-Level Logs
🔹 Administrator Command
oc adm node-logs <node_name>
This command requires administrator level cluster permissions and will return logs
from the system services
running on your nodes.
• Requires cluster-admin privileges.
• Used to fetch logs from node-level system services (e.g., kubelet, cri-o).
Examples:
# Logs from master nodes
oc adm node-logs –role master
# Only kubelet logs
oc adm node-logs –role master -u kubelet
4⃣ Using oc describe for Event & Log Context
oc describe pod/<pod_name>
• Shows detailed information about the pod:
o Events (start, restart, errors)
o State transitions
o Container names and statuses
Useful Tip:
Find container names here if a pod has multiple containers — you can then target container-
specific logs:
oc logs -f <pod_name> -c <container_name>
5⃣ 🧩 Practical Example: Troubleshooting NGINX Deployment
Scenario:
• Deploying an NGINX app requiring root privileges.
• OpenShift runs containers as non-root users by default (security best practice).
Steps:
1. Login as developer user.
2. Create project:
3. oc new-project log-demo
4. Deploy app:
5. oc new-app –-name=log-demo -–docker-image=nginx
6. Check pod status:
7. oc get pods
Pod shows status: CrashLoopBackOff → container is failing to start.
8. Inspect logs:
9. oc logs -f <pod_name>
10. oc logs -f <pod_name> -c log-demo
11.
12. Output shows permission denied errors — container can’t write to
system directories.
13. Confirm with describe:
14. oc describe pod/<pod_name>
Identify container name (e.g., log-demo) and review details.
15. Root Cause:
o NGINX is attempting to perform privileged operations.
o Container is non-root → permission issues.
16. Solution:
o Modify deployment configuration to allow appropriate privileges, or
o Use a base image that doesn’t require root access.
6⃣ Viewing Logs in the Web Console
🔹 Steps:
1. Log into OpenShift Web Console as developer.
2. Navigate to your project (e.g., log-demo).
3. Go to Project → Pods.
4. Click on the desired pod → open Logs tab.
Features:
• View logs per container (switch using dropdown).
• Filter or search logs.
• Download logs for offline analysis.
7⃣ Key Takeaways
✅ Use oc logs for real-time or historical logs of builds, pods, or deployments.
✅ Use oc adm node-logs for node-level diagnostics (admins only).
✅ Use oc describe to view events, resource details, and container names.
✅ The Web Console provides an easy graphical way to view and download logs.
✅ Always check logs when a pod enters CrashLoopBackOff or Error states.
✅ Logs are your first stop for troubleshooting and exam scenarios.
🧠 Summary Table
Command Purpose Notes
oc logs -f <pod> Stream pod logs live Use --tail to limit lines
oc logs -f bc/<buildconfig> Stream build logs Follows latest build
oc logs -f Stream deployment
dc/<deploymentconfig> Tracks rollout progress
logs
oc adm node-logs Node/system logs Admin-only
Events & detailed
oc describe <resource> Great for finding container names
info
Filter, switch containers, or
Web Console → Pods → Logs GUI log viewing
download logs
🏁 Closing Notes
• Logs are your best friend for debugging and learning what’s really happening inside
OpenShift.
• Think of them as a treasure map pointing you to the root cause of issues.
• By mastering oc logs, oc describe, and oc adm node-logs, you’ll be fully
equipped for both real-world troubleshootingand the exam.
🧠 Lecture Notes: Assessing the Health of an OpenShift Cluster
🎯 Objective
Learn how to assess and monitor the health of an OpenShift cluster using CLI tools and built-
in components like nodes, etcd, and operators.
🧩 1. Cluster Health Overview
As an OpenShift Administrator, maintaining cluster health ensures:
• Application reliability
• Smooth resource utilization
• Early detection of issues
Key Components:
• Nodes
• etcd (data store)
• Operators
• Version Compatibility
⚙ 2. Node Health
Nodes are the backbone of your OpenShift cluster.
They run the containers and provide CPU, memory, and network resources.
🧾
Commands:
1. List all nodes:
2. oc get nodes
o Displays all nodes and their status.
o ✅ Ready = healthy, ❌ NotReady = issue to investigate.
3. Check resource usage (CPU/Memory):
4. oc adm top nodes
o Shows real-time node metrics.
o Requires metrics-server to be running.
5. Inspect specific node details:
6. oc describe node <node-name>
o Shows:
§ Allocated resources
§ Conditions
§ Recent events
§ Non-terminated pods
🧠 Tip: Use this command often to diagnose node-level issues.
🧠 3. etcd Health
• etcd = Central database of OpenShift.
• Stores configuration, secrets, and cluster state.
• Any etcd issue → affects the entire cluster.
Commands:oc woami
🧾
Kubeadmin
oc get pods -n openshift-etcd. :first we get the podname
oc -n openshift-etcd rsh etcd-crc : then we rsh to the pod: This command
allows you to connect to an etcd pod and check the health of the etcd cluster.
1. Check etcd health:
2. oc rsh -n openshift-etcd <etcd-pod-name> etcdctl endpoint health --
cluster
o Shows health of each etcd member. Quick overview
3. View etcd logs:
4. oc logs -n openshift-etcd etcd-crc
o Look for warnings or errors indicating latency or connectivity issues.
🧠 Tip:
Set up alerts for etcd latency, disk I/O, or network delay.
It's important to establish a baseline for etcd performance, and set up alerts to notify
you of any
deviations or anomalies.
🧰 4. Operators Health
Operators manage the lifecycle of OpenShift components and ensure everything stays in the
desired state.
🧾
Commands:
1. Check operator status:
2. oc get clusteroperators
o Available=True ✅ means healthy.
o Progressing=True ⏳ = update in progress.
o Degraded=True ⚠ = issue detected.
3. Inspect degraded operatorLwe can use oc log)
4. oc describe clusteroperator <operator-name>
5. oc logs -n <operator-namespace> <operator-pod>
o Check for related error messages.
🔢 5. Version Checks
Ensure client and server versions are compatible.
1. Check cluster version:
2. oc describe clusterversion
3. Check OpenShift and Kubernetes versions:
4. oc version
o Confirms if client and server versions match.
🚀 6. Demo Steps
Step 1: List Node Status
oc get nodes
Step 2: Monitor Node Resources
oc adm top nodes
Step 3: Inspect a Node
oc describe node <node-name>
Step 4: Check etcd Health
oc get pods -n openshift-etcd
oc rsh -n openshift-etcd <etcd-pod> etcdctl endpoint health --cluster
Step 5: Examine etcd Logs
oc logs -n openshift-etcd <etcd-pod>
Step 6: Check Operators
oc get clusteroperators
Step 7: Verify Versions
oc version
oc describe clusterversion
🧩 7. Summary
Component Command Purpose
Nodes oc get nodes Check node status
Nodes oc adm top nodes Monitor CPU/memory usage
etcd oc rsh … etcdctl endpoint health Check etcd health
Operators oc get clusteroperators Monitor operator status
Version oc version Verify client-server compatibility
✅ Key Takeaways
• Regularly check node, etcd, and operator health.
• Use logs and metrics to identify early issues.
• Always ensure version compatibility.
• Healthy cluster = reliable application performance.
🧠 Lecture Notes: Troubleshooting Common Container, Pod, and
Cluster Events & Alerts in OpenShift
🎯 Objective
Learn to identify, analyze, and troubleshoot common container, pod, and cluster-level issues
in OpenShift using logs, events, and commands.
⚙ 1. Understanding Events and Alerts
• OpenShift automatically generates events and alerts to indicate:
o Problems (failures, crashes)
o State changes (Pending, Terminating)
o Resource constraints
• These help administrators detect and fix issues before they affect workloads.
🧩 2. Troubleshooting Common Container Issues
🚨 Issue 1: Container Crash / Failure to Start
Possible causes:
• Application misconfiguration
• Missing dependencies
• Resource limits
• When a container crashes, your first instinct should be to examine the
container logs.
• You can do this by using the OC logs command followed by the pod and
container names.
•
Troubleshooting steps:
1. Check logs:
2. oc logs <pod-name> -c <container-name>
→ Reveals application errors or missing files.
3. Describe pod for events:
4. oc describe pod <pod-name>
→ Check Events section for messages like:
o Failed to pull image
o CrashLoopBackOff
Back-off restarting container Pay attention to the exit codes and error messages to
identify the root cause of the issue.
For example, an event like failed to pull image indicates that the container image specified in
the
pod configuration could not be retrieved from the registry.
o
5. If image pull fails:
o Verify image name, tag, and registry access.
🚨 Issue 2: Exceeding Resource Limits
• If CPU/memory limits are exceeded, container may throttle or terminate.
Check resource usage:
oc adm top pod
Solution:
• Increase limits in Deployment or Pod spec:
• resources:
• requests:
• memory: "256Mi"
• cpu: "250m"
• limits:
• memory: "512Mi"
• cpu: "500m"
🧱 3. Troubleshooting Pod Issues
🚨 Issue 1: Pod Stuck in Pending State
Possible causes:
• Insufficient node resources
• Taints/tolerations mismatch
• NodeSelector or affinity mismatch
Commands:
oc describe pod <pod-name>
Check Events for:
• "0/1 nodes are available: insufficient CPU."
• "node(s) didn’t match node selector"
Solutions:
• Adjust resource requests.
• Add more nodes.
• Fix nodeSelector or taint mismatch.
🚨 Issue 2: Pod Evicted or Terminated Repeatedly
Causes:
• Node resource pressure
• Node failure
Check events:
oc get events --field-selector
[Link]=Pod,[Link]=<pod-name>
Look for:
• Evicted
• NodeLost
Fix:
• Add cluster resources.
• Investigate node health.
🚨 Issue 3: Pod Stuck in Terminating State
Causes:
• Network disconnection
• Container runtime issues
Solution:
Force delete (use cautiously):
oc delete pod <pod-name> --grace-period=0 --force
🧠 Note: Always investigate root cause before force deletion.
🧠 4. Troubleshooting Cluster-Level Issues
🧩 a) etcd Issues
• etcd stores all cluster configuration and state data.
• Problems can cause cluster instability.
Common issues:
• High latency
• Disk I/O bottlenecks
• Network problems
Commands:
For example, you can use etcd CTL endpoint health to check the health of etcd
members and identify
any problematic nodes.
can use the etcd CTL command line tool.
1. List etcd pods:
2. oc get pods -n openshift-etcd
3. Check health:
4. oc rsh -n openshift-etcd <etcd-pod> etcdctl endpoint health --cluster
5. View logs:
6. oc logs -n openshift-etcd <etcd-pod>
🧠 Tip: Monitor etcd metrics and set alerts for latency spikes.
🌐 b) Network Connectivity Issues
Symptoms:
• Pods can't communicate with each other or external services.
Possible causes:
• Misconfigured network policies
• Firewall restrictions
• Network plugin failure
Steps:
1. Inspect Pod Network Details:
2. oc describe pod <pod-name> } Look for any error messages or indications of network
related problems.
3. Check connectivity between pods:
4. oc exec -it <pod-1> -- ping <pod-2-IP>
5. Additionally, you can use network diagnostic tools like ping, traceroute or
telnet to test connectivity
6. between pods or external endpoints. : oc exec my-pod –ping another-pod
7.
8. Use tools like:
o traceroute
o telnet
o curl
9. Verify network policies:
10. oc get networkpolicy -A
🧪 5. Demo: Troubleshooting Pod Scheduling (NodeSelector Example)
🎬 Scenario
A new app is created with a nodeSelector condition, but no node matches it → Pod remains
in Pending state.
🧰 Demo Steps
Oc get pods
we'll create a new application using the OC new app command and specify a node
selector
condition that requires the label node name equals CRC.
1. Create an application with node selector:
2. oc run nginx –-image=bitnami/nginx -–overrides=’{“spec”: {“nodeSelector”:
{“nodename”: crc”}}}’
3. oc new-app nginx --dry-run=client -o yaml > [Link]
Add in [Link]:
spec:
template:
spec:
nodeSelector:
nodeName: CRC
Then apply:
oc apply -f [Link]
4. Check pod status:
5. oc get pods
→ Pod shows Pending.
6. Describe pod for details:
7. oc describe pod <pod-name>
Event Output:
0/1 nodes are available: node(s) didn’t match node selector.
8. Label the node: Let's add the node name equals CRC label to our node to
resolve this.
9. oc label node crc nodeName=crc
10. Check pod again:
11. oc get pods
→ Pod now shows Running ✅
Oc describe pod nginx
🧩 Lesson Takeaways
Issue Type Useful Commands Fix
Container crash oc logs, oc describe pod Check logs, fix image/config
Resource limit oc adm top pods Adjust limits
Pod pending oc describe pod Fix selector / resources
Pod evicted oc get events Add resources, check node
etcd issues etcdctl endpoint health Monitor health, logs
Network issues oc exec ping, oc describe Fix network policies
✅ Summary
• Use logs + describe + events for root-cause diagnosis.
• Monitor nodes, etcd, and network continuously.
• Understand pod lifecycle to troubleshoot effectively.
• Practice real scenarios like Pending, CrashLoopBackOff, Evicted, and
Terminating pods.
The commands "oc get nodes", "oc adm top nodes", and "oc describe node" are all
useful for assessing the health of nodes in an OpenShift cluster. "oc get nodes"
provides a general overview of node status, "oc adm top nodes" shows resource
usage, and "oc describe node" gives detailed information about a specific node.
The oc whoami --show-console command provides the URL directly, while "oc get
routes -n openshift-console" lists the routes in the openshift-console namespace,
which includes the route for accessing the web console.
🧠 Lecture Notes: Using Product Documentation in
OpenShift
🎯 Objective
Learn how to effectively access, navigate, and utilize OpenShift product documentation to
understand features, troubleshoot issues, and stay updated with new releases.
🧩 1. Importance of Documentation
As an OpenShift administrator, the official product documentation is your go-to guide for:
• Understanding platform features
• Learning installation, configuration, and management
• Troubleshooting issues
• Exploring best practices and new capabilities
💡 The documentation is continuously updated with every new release.
🌐 2. Accessing the Official Documentation
Primary Source:
👉 [Link]
• Central hub for Red Hat OpenShift Container Platform docs
• Contains:
o Installation guides
o Configuration steps
o Administration procedures
o Developer workflows
o Release notes
Steps to Access:
1. Visit [Link]
2. Select your OpenShift version from the dropdown (OCP section)
3. Browse through the structured sidebar for relevant topics
🧭 3. Navigating the Documentation Structure
📂 Main Sections
Section Description
Getting Started Introductory guide for new users
Architecture Explains core OpenShift components
Installation Step-by-step platform setup
Post-installation Configuration Cluster customization, access control
Application Management Creating and deploying applications
Operators Managing lifecycle of services
Networking & Storage Connectivity and persistent data handling
Monitoring & Logging Observing cluster performance and logs
Security RBAC, authentication, and compliance
Backup & Restore Disaster recovery and data protection
⚙ 4. Example: Creating and Deploying an Application
🧱 Step 1: Create a New Project
• Go to the Developer Activities section
• Locate Work with Projects → Open it in a new tab
• Follow the guide to:
o Create a new project (Web Console or CLI)
o Set access permissions
o View or delete projects
📘 Each step includes screenshots and detailed explanations.
🚀 Step 2: Deploy a New Application
• From Developer Activities, open Creating Applications using Developer
Perspective
• Explore multiple deployment options:
o Quickstarts
o Import existing codebase
o Deploy from container image
Example Topics Covered:
• YAML examples for configurations
• Customizing sample manifests
• Environment variable setup
• Common troubleshooting tips
📝 Tip: Note down best practices and recommendations for smoother deployments.
💻 5. Command Line Documentation Access
OpenShift CLI (oc) provides inline help and documentation for quick reference.
Command Purpose Example
oc help
Displays general or subcommand oc help get
help
oc <command> -h
Shows usage and flags for a oc new-app -h
command
oc explain Explains fields and specs of a oc explain
<resource> resource [Link]
oc version
Displays OC client and cluster oc version
version
💡 These are extremely useful when scripting or working without browser access.
📘 6. Best Practices When Using Documentation
• Bookmark frequently used sections (installation, networking, security)
• Cross-check version-specific changes before applying commands
• Use examples and YAML snippets as templates
• Read release notes for feature updates and deprecations
• Leverage search to quickly find command references
• Combine CLI help + official docs for complete understanding
🧩 7. Summary
Key Area Description
Access Docs [Link]
Navigation Choose version → explore categories
CLI Support Use oc help, oc explain, and oc version
Hands-on Follow step-by-step examples and YAML snippets
Continuous Learning Check documentation regularly for updates
✅ Takeaway
The OpenShift Product Documentation is your essential guide for:
• Learning new concepts
• Troubleshooting efficiently
• Ensuring cluster consistency across updates
• Following best practices for stability and security
🧭 Always refer to official documentation and in-terminal help before applying
configurations or troubleshooting commands.