0% found this document useful (0 votes)
2 views13 pages

Ocnotes 1

Openshift notes

Uploaded by

brownkudi2001
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views13 pages

Ocnotes 1

Openshift notes

Uploaded by

brownkudi2001
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Extracting Secrets/ConfigMaps:

Managing Kubernetes Resources in OpenShift


• First list secrets: oc get secrets

! Overview •
oc extract secret/<secret_name>
Then extract: oc extract secret/<secret_name> --to=./
o You can also specify a target directory (e.g. /tmp/).
As an OpenShift administrator, you must manage the lifecycle of resources — importing, • You can extract the file and send it to another location by appending the path after
exporting, and configuring Kubernetes objects such as Deployments, Services, ConfigMaps, tmp.
and Secrets. •
o

" Importing Resources


⚙ Modifying Resource Configurations
Purpose:
Bring existing Kubernetes manifests (YAML or JSON) into your OpenShift cluster. Steps:
Command: nano [Link]
oc apply -f <directory_or_file_path>

oc apply -f ./test 1. Export the YAML file.


2. Open it in a text editor.
Details: 3. Change fields (replica count:2, environment variables, hanging service port
mappings.
• Creates or updates resources defined in the manifests. 4. save
• Works on a single file or an entire directory. 5. Apply updated configuration:
oc apply -f [Link]
Example:
oc apply -f ./manifests/ Note:
If the resource was originally created using oc new-app, you may see a warning when
applying changes.

For im[portingindividual resorce files by specifying the file path instead of a Check Results:
directory. oc get pods — verify replicas and pod states.

Oc apply -f ./test/service_account.yaml If we do the OC get pods command, we can see that we have two pod replicas
instead of one.

# Exporting Resources
⚖ Declarative vs Imperative Commands
Purpose:
Backup, duplicate, or share resource configurations. Approach Commands Style Description
Declarative Desired Define what you want; OpenShift
Command: oc apply -f
oc get <resource_type> <resource_name> -o yaml > [Link] (Preferred) state figures out how to achieve it.
oc create, oc delete, oc Step-by- You explicitly tell OpenShift
Imperative
Examples: patch, oc replace, oc edit step what to do.

This command retrieves the definition of the first app deployment and saves it to a Declarative (oc apply)
file named my [Link].
• Checks if the resource exists:
• oc get deployment first-app -o yaml > [Link] o If not → creates it.
• you can export other types of resources such as services, config maps, or o If yes → updates only what changed.
secrets by replacing • Ideal for Infrastructure as Code (IaC) workflows.
• oc get svc,cm,secret -o yaml • Great for GitOps and version control.
Imperative Commands

• Execute direct actions manually. ! 2. What is a Container Image?


• Useful for quick, one-off operations or troubleshooting.
• Defines the application code, dependencies, and runtime environment.
Immutable Fields • Every pod is created from one or more container images.

If certain properties cannot be changed, OpenShift shows a warning.


To force the update (⚠ use cautiously):
oc apply --force -f [Link] ! 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
& Commonly Used oc Subcommands images.

Command Description
oc get List or view resources in cluster ! 4. OpenShift Image Streams
oc describe Detailed info about a resource
oc create Create from a file or stdin new resources from yaml json maifest • OpenShift uses Image Streams instead of raw images.
oc apply Create or update declaratively • An Image Stream is:
oc delete Remove a resource from clustedr o A sequence of pointers to one or more container images.
o Acts as an abstraction layer for easier image management.
oc edit Edit resources interactively in terminal
o Can be linked to deployments for automatic updates.
oc logs View container logs • Images can come from:
oc exec Run a command inside a container o Internal registry (built into OpenShift)
o External registries (e.g., [Link], Docker Hub)
Help Command:
oc -h

! 5. Default Image Streams

' Summary • When OpenShift is installed, it automatically creates Red Hat–provided image
streams.
✅ Import: oc apply -f <file_or_dir> • These are available in the openshift project (default global project).
• All users have view access to this project.
✅ 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. ! 6. Key Commands
✅ Use imperative commands for direct or quick actions.
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,
( Locating and Examining Container Images in image stream <name> -n openshift repository, tags, and image IDs.
OpenShift Get details of a oc describe image
<image_id>
Displays metadata — image ID, size,
specific image creation time, ports, env vars, etc.
! 1. Importance Downloads and extracts image
Extract image oc image extract <image> -
-path /:/local/dir contents to your local system for
contents
• As an OpenShift administrator, it’s crucial to know how to find and inspect inspection.
container images running in the cluster.
• Helps in managing and troubleshooting applications.
! 7. Inspecting Images
• oc describe provides: Notes: Projects in OpenShift
o Docker image ID
o Image size
o Creation date
! 1. What is a Project in OpenShift?
o Exposed ports
o Environment variables
o Repository source
• A project in OpenShift is a logical unit that organizes and isolates resources within a
• oc image extract:
cluster.
o Extracts file system of the image.
• Each project contains:
o Deployments
o You can explore configuration files, binaries, and app code locally.
o Pods
• Another way to examine a container image is to use the OC image Extract
o Services
command to download the image
o Routes
• contents to your local file system.
o ConfigMaps, etc.
• Running the OC image extract command will extract the file system contents
• Projects also enable access control, defining who can access and manage specific
of the specified image and
resources.
• 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 ! 2. Purpose of Projects
understand how the
• image is structured and what it contains. • Isolation: Keeps different applications and teams separated.
• By combining these techniques, such as listing image streams, describing • Organization: Groups related resources under one logical unit.
image and image stream details, • Access Control: Determines user permissions within the project.
• and extracting image contents for further inspection. • Resource Management: Supports quotas and limits per project.
• You can comprehensively understand the container images deployed in your
OpenShift cluster.
• That concludes our lecture on locating and examining container images in
OpenShift. ! 3. Creating a Project (CLI Method)
• Please explore the container images in your cluster and apply the techniques ✅
Step 1: Login to Cluster
covered in this demo.
oc login -u developer -p <password> [Link]
o ✅
Step 2: Create a New Project
oc new-project my-demo-project

! 8. Summary • Creates a new project named my-demo-project.


• Automatically switches the CLI context to the new project.

• Use image streams for efficient image management in OpenShift.
• Commands like oc get, oc describe, and oc image extract help in: Step 3: Verify the Project
oc projects
o Listing,
o Inspecting, and
o Exploring container images. • Lists all projects available to the logged-in user.
• Combining these techniques gives a comprehensive view of how images are used • The new project should appear in the list.
and structured in your OpenShift cluster.

✅ 4. Deploying an Application
!
! 9. Next Steps Step 1: Create a Simple App
oc new-app -–name=my-app –-image-openshift/hello-openshift
• Practice the commands in your own OpenShift environment.
• Explore different image streams in the openshift project. ✅• Deploys a simple "Hello OpenShift" application using the provided image.
• Next topic: Creating and Deleting Projects in OpenShift.
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.
3. Confirm deletion by typing the project name.
4. Click Delete.
! 5. Viewing Project Resources
Get an Overview of All Resources ⚠ Caution:
✅oc get all Deleting a project removes all its resources permanently.

• Displays all resources in the current project (deployments, pods, services, etc.).
! 9. Key Takeaways
✅ Describe Project Details
oc describe project my-demo-project
• Projects are fundamental for:
o Organizing workloads
• Provides detailed information including:
o Metadata (labels, annotations) o Managing access control
o Resource quotas and limits o Isolating environments
o Events and usage stats
• 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).

! 6. Deleting a Project (CLI Method)


oc delete project my-demo-project
! 10. Summary of Common Commands
• Deletes the project and all associated resources. Action Command
• To confirm deletion: Login to cluster oc login -u developer
Create project oc new-project my-demo-project
oc projects
List projects oc projects
• The deleted project will no longer appear. Deploy app oc new-app openshift/hello-openshift --name=myapp
View resources oc get all
# Note: Describe project oc describe project my-demo-project
After deletion, the message
Delete project oc delete project my-demo-project

“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:
! Notes: Examining Resources and Cluster Status in OpenShift
1. Log in to the OpenShift Web Console as developer.
2. Click Add (top-left corner).
3. Select Projects. ! 1. Importance
4. Click Create Project.
5. Enter:
• As an OpenShift administrator or developer, understanding your cluster resources
o Project Name → my-demo-project
and overall health is essential.
o Optional: Display Name & Description
• Helps in monitoring performance, troubleshooting issues, and managing
6. Click Create.
workloads efficiently.
✅ The new project appears in the Developer View.

! 2. Basic Resource Examination



! 8. Deleting a Project (Web Console Method) Crc console --credentials
Login
1. Go to the Project View. oc login -u kubeadmin -p <password> [Link]
2. Click the Actions (⋮) dropdown → choose Delete Project.
Common Commands • With OC ADM you can manage nodes, control, access and gather important
✅ insights about your clusters
Purpose Command Description
• resource utilization.
Lists deployments in the current • The OC ADM top nodes command is handy when you want to monitor the
List deployments oc get deployments
project. resource consumption of your cluster
oc get pods -n
List pods in <namespace>(openshift-
Views pods in a specified • nodes.
another namespace apiserver) namespace. •
List pods from all oc get pods --all-namespaces Displays pods across the entire
namespaces cluster. ✅ Examples
Shows detailed info about a Task Command Description
Describe a oc describe <resource> <name> resource. Inspect abt the state Show node Displays CPU & memory
resource oc adm top nodes
and detail resource usage usage of each node.
Sort nodes by oc adm top nodes --sort-by=cpu
Helps identify high CPU-
$ Use oc get and oc describe for any resource type (e.g., pods, services, routes, CPU usage consuming nodes.
deployments, etc.). Show pod Displays CPU & memory
oc adm top pods
resource usage usage per pod.
Pod usage by oc adm top pods - Limits view to a specific
namespace namespace=<namespace>(my-namespace) namespace.
! 3. Checking Cluster Status
✅ Cluster Overview
You can also use labels to filter the pods you want to see.:oca dm top pods –l
oc status app=app-name

• Gives a summary of: # Note: On OpenShift Local (CRC), monitoring operators are not installed, so metrics may
o Current project
not appear.
o Services and deployments
o Recent events or warnings

! 6. Monitoring via Web Console



! 4. Node and Control Plane Health Access the Dashboard

List All Nodes
1. Log in as kubeadmin.
oc get nodes
2. Go to Home → Overview.
3. Dashboard sections include:
• Displays:
o Node names
Section Description
o Status (Ready, NotReady)
o Roles (master/worker) Cluster Details Shows cluster ID, provider, OpenShift version.
o Age and version Cluster Inventory Counts of nodes, pods, storage classes, and PVCs.

Cluster Status Shows health of control plane and operators.
Check Control Plane Components Cluster Utilization Graphs for CPU, memory, and storage trends (requires Prometheus).
oc get componentstatuses
Activity Feed Lists recent events, alerts, and cluster changes.
• Shows health of:
o Scheduler # In OpenShift Local, advanced monitoring (Prometheus dashboards) may be unavailable.
o etcd
o Controller Manager
• Status indicates whether each component is healthy or facing issues.
! 7. Good Practices

% • Check cluster health regularly using oc status and dashboard overview.


! 5. The oc adm Command (Administrator Toolkit) • Monitor resource utilization with oc adm top commands.
• Investigate alerts and degraded operators immediately.
Purpose
• Use labels and namespaces to filter specific workloads for easier management.
• Used for cluster-wide administration and performance monitoring.
• Acts as the "Swiss Army knife" for OpenShift administrators.
! 8. Key Commands Summary " Streaming Logs in Real Time
Command Purpose oc logs -f <resource_name>

oc get <resource> Lists resources


• The -f (follow) flag streams logs live as they’re generated.
oc describe <resource> <name> Detailed view of a resource
• Commonly used for watching builds and deployments in progress.
oc status Overview of current project
oc get nodes View node list and status Examples:
oc get componentstatuses Check control plane health
# Follow logs for the most recent build
oc adm top nodes View node resource usage oc logs -f bc/<buildconfig_name>
oc adm top pods View pod resource usage
# Follow logs for the latest deployment
oc logs -f deployment/<deployment-name>

! 9. Summary
" Viewing Specific Versions
• oc get and oc describe → Examine resources.
• oc status → Check project overview. If you want logs from a specific version, specify the version number:
• oc get nodes / oc get componentstatuses → Check cluster health.
• oc adm top → Monitor resource utilization. # For a specific deployment version
• Web Console → Visual monitoring and insights. oc logs -deployment/<deployment-name> -version=<version-number>
# For a specific build version
• Regular monitoring ensures cluster stability and proactive issue resolution. 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>

! Lesson Notes: Viewing and Analyzing Logs in # Show only the last 10 lines
oc logs -f pod/<pod_name> --tail=10 (oc logs -f pod my-pod--tail=10)

OpenShift
$ Viewing Node-Level Logs
" Introduction ! Administrator Command
oc adm node-logs <node_name>
• Logs are essential for troubleshooting, monitoring, and understanding what’s This command requires administrator level cluster permissions and will return logs
happening inside your OpenShift cluster. from the system services
• They help diagnose issues like crash loops, failed deployments, or permission running on your nodes.
errors.
• You’ll use both the CLI (oc logs) and the Web Console to access and analyze logs.
• Requires cluster-admin privileges.
• Used to fetch logs from node-level system services (e.g., kubelet, cri-o).

# Viewing Logs from the CLI Examples:

! The oc logs Command # Logs from master nodes


oc adm node-logs –role master

• The main command for retrieving logs of pods, builds, or deployments. # Only kubelet logs
• Syntax help: oc adm node-logs –role master -u kubelet
• oc logs -h

Displays available options and usage examples. % Using oc describe for Event & Log Context
oc describe pod/<pod_name>

• Shows detailed information about the pod:


o Events (start, restart, errors) Features:
o State transitions
o Container names and statuses • View logs per container (switch using dropdown).
• Filter or search logs.
Useful Tip: • Download logs for offline analysis.
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> ( Key Takeaways


✅ Use oc logs for real-time or historical logs of builds, pods, or deployments.
& ! Practical Example: Troubleshooting NGINX Deployment ✅ Use oc adm node-logs for node-level diagnostics (admins only).
Scenario: ✅ Use oc describe to view events, resource details, and container names.
✅ The Web Console provides an easy graphical way to view and download logs.
• Deploying an NGINX app requiring root privileges. ✅ Always check logs when a pod enters CrashLoopBackOff or Error states.
• OpenShift runs containers as non-root users by default (security best practice). ✅ Logs are your first stop for troubleshooting and exam scenarios.

Steps:

1. Login as developer user. ) Summary Table


2. Create project:
3. oc new-project log-demo Command Purpose Notes
4. Deploy app: oc logs -f <pod> Stream pod logs live Use --tail to limit lines
5. oc new-app –-name=log-demo -–docker-image=nginx
oc logs -f bc/<buildconfig> Stream build logs Follows latest build
6. Check pod status:
7. oc get pods oc logs -f Stream deployment
dc/<deploymentconfig> Tracks rollout progress
logs
Pod shows status: CrashLoopBackOff → container is failing to start. oc adm node-logs Node/system logs Admin-only
Events & detailed
8. Inspect logs: oc describe <resource> Great for finding container names
info
9. oc logs -f <pod_name>
10. oc logs -f <pod_name> -c log-demo Filter, switch containers, or
Web Console → Pods → Logs GUI log viewing
11. download logs
12. Output shows permission denied errors — container can’t write to
system directories.
13. Confirm with describe:
14. oc describe pod/<pod_name> * Closing Notes

Identify container name (e.g., log-demo) and review details. • Logs are your best friend for debugging and learning what’s really happening inside
OpenShift.
15. Root Cause: • Think of them as a treasure map pointing you to the root cause of issues.
o NGINX is attempting to perform privileged operations. • By mastering oc logs, oc describe, and oc adm node-logs, you’ll be fully
o Container is non-root → permission issues. equipped for both real-world troubleshootingand the exam.
16. Solution:
o Modify deployment configuration to allow appropriate privileges, or
o Use a base image that doesn’t require root access.

) Lecture Notes: Assessing the Health of an OpenShift Cluster


' Viewing Logs in the Web Console
# Objective
! Steps:
Learn how to assess and monitor the health of an OpenShift cluster using CLI tools and built-
1. Log into OpenShift Web Console as developer. in components like nodes, etcd, and operators.
2. Navigate to your project (e.g., log-demo).
3. Go to Project → Pods.
4. Click on the desired pod → open Logs tab.
$ 1. Cluster Health Overview 1. Check etcd health:
2. oc rsh -n openshift-etcd <etcd-pod-name> etcdctl endpoint health --
cluster
As an OpenShift Administrator, maintaining cluster health ensures: o Shows health of each etcd member. Quick overview
3. View etcd logs:
• Application reliability 4. oc logs -n openshift-etcd etcd-crc
• Smooth resource utilization o Look for warnings or errors indicating latency or connectivity issues.
• Early detection of issues
( Tip:
Key Components: Set up alerts for etcd latency, disk I/O, or network delay.

• Nodes It's important to establish a baseline for etcd performance, and set up alerts to notify
• etcd (data store) you of any
• Operators deviations or anomalies.
• Version Compatibility

⚙ 2. Node Health
' 4. Operators Health
Nodes are the backbone of your OpenShift cluster.
They run the containers and provide CPU, memory, and network resources. Operators manage the lifecycle of OpenShift components and ensure everything stays in the
& Commands: desired state.
&
Commands:
1. List all nodes:
2. oc get nodes
1. Check operator status:
o Displays all nodes and their status. 2. oc get clusteroperators
o ✅ Ready = healthy, ❌ NotReady = issue to investigate. o Available=True ✅ means healthy.
3. Check resource usage (CPU/Memory): o Progressing=True ⏳ = update in progress.
4. oc adm top nodes
o Shows real-time node metrics. o Degraded=True ⚠ = issue detected.
o Requires metrics-server to be running. 3. Inspect degraded operatorLwe can use oc log)
4. oc describe clusteroperator <operator-name>
5. Inspect specific node details: 5. oc logs -n <operator-namespace> <operator-pod>
6. oc describe node <node-name>
o Check for related error messages.
o Shows:
§ Allocated resources
§ Conditions
§ Recent events
( 5. Version Checks
§ Non-terminated pods

Ensure client and server versions are compatible.


( Tip: Use this command often to diagnose node-level issues.
1. Check cluster version:
2. oc describe clusterversion
3. Check OpenShift and Kubernetes versions:
& 3. etcd Health 4. oc version
o Confirms if client and server versions match.
• etcd = Central database of OpenShift.
• Stores configuration, secrets, and cluster state.
&• Any etcd issue → affects the entire cluster.
) 6. Demo Steps
Commands:oc woami Step 1: List Node Status
Kubeadmin oc get nodes
Step 2: Monitor Node Resources
oc get pods -n openshift-etcd. :first we get the podname
oc adm top nodes
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. Step 3: Inspect a Node
oc describe node <node-name>
Step 4: Check etcd Health ! 2. Troubleshooting Common Container Issues
oc get pods -n openshift-etcd
oc rsh -n openshift-etcd <etcd-pod> etcdctl endpoint health --cluster
+ Issue 1: Container Crash / Failure to Start
Step 5: Examine etcd Logs
oc logs -n openshift-etcd <etcd-pod>
Possible causes:
Step 6: Check Operators
oc get clusteroperators • Application misconfiguration
Step 7: Verify Versions • Missing dependencies
oc version • Resource limits
oc describe clusterversion • 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
$ 7. Summary container names.
Component Command Purpose •
Nodes oc get nodes Check node status
Troubleshooting steps:
Nodes oc adm top nodes Monitor CPU/memory usage
etcd oc rsh … etcdctl endpoint health Check etcd health 1. Check logs:
Operators oc get clusteroperators Monitor operator status 2. oc logs <pod-name> -c <container-name>
Version oc version Verify client-server compatibility
→ Reveals application errors or missing files.

✅ Key Takeaways 3. Describe pod for events:


4. oc describe pod <pod-name>

• Regularly check node, etcd, and operator health. → Check Events section for messages like:
• Use logs and metrics to identify early issues.
• Always ensure version compatibility. o Failed to pull image
• Healthy cluster = reliable application performance. 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
) Lecture Notes: Troubleshooting Common Container, Pod, and 5. If image pull fails:
Cluster Events & Alerts in OpenShift o Verify image name, tag, and registry access.

# Objective
+ Issue 2: Exceeding Resource Limits
Learn to identify, analyze, and troubleshoot common container, pod, and cluster-level issues
in OpenShift using logs, events, and commands.
• If CPU/memory limits are exceeded, container may throttle or terminate.

Check resource usage:


⚙ 1. Understanding Events and Alerts oc adm top pod

• OpenShift automatically generates events and alerts to indicate: Solution:


o Problems (failures, crashes)
o State changes (Pending, Terminating) • Increase limits in Deployment or Pod spec:
o Resource constraints • resources:
• These help administrators detect and fix issues before they affect workloads. • requests:
• memory: "256Mi"
• cpu: "250m"
• limits: + Issue 3: Pod Stuck in Terminating State
• memory: "512Mi"
• cpu: "500m"
Causes:

, 3. Troubleshooting Pod Issues • Network disconnection


• Container runtime issues
+ Issue 1: Pod Stuck in Pending State
Solution:
Force delete (use cautiously):
Possible causes:
oc delete pod <pod-name> --grace-period=0 --force
• Insufficient node resources
• Taints/tolerations mismatch ( Note: Always investigate root cause before force deletion.
• NodeSelector or affinity mismatch

Commands:

oc describe pod <pod-name>


) 4. Troubleshooting Cluster-Level Issues

Check Events for:


$ a) etcd Issues

• "0/1 nodes are available: insufficient CPU." • etcd stores all cluster configuration and state data.
• "node(s) didn’t match node selector" • Problems can cause cluster instability.

Solutions: Common issues:

• Adjust resource requests. • High latency


• Add more nodes. • Disk I/O bottlenecks
• Fix nodeSelector or taint mismatch. • Network problems

Commands:

+ Issue 2: Pod Evicted or Terminated Repeatedly For example, you can use etcd CTL endpoint health to check the health of etcd
members and identify
Causes: any problematic nodes.

• Node resource pressure


• Node failure
can use the etcd CTL command line tool.
Check events:
1. List etcd pods:
oc get events --field-selector 2. oc get pods -n openshift-etcd
[Link]=Pod,[Link]=<pod-name> 3. Check health:
4. oc rsh -n openshift-etcd <etcd-pod> etcdctl endpoint health --cluster
Look for: 5. View logs:
6. oc logs -n openshift-etcd <etcd-pod>
• Evicted
• NodeLost ( Tip: Monitor etcd metrics and set alerts for latency spikes.

Fix:

• Add cluster resources. , b) Network Connectivity Issues


• Investigate node health.
Symptoms:

• Pods can't communicate with each other or external services.

Possible causes:
• Misconfigured network policies 6. Describe pod for details:
• Firewall restrictions 7. oc describe pod <pod-name>
• Network plugin failure
Event Output:
Steps:
0/1 nodes are available: node(s) didn’t match node selector.
1. Inspect Pod Network Details:
2. oc describe pod <pod-name> } Look for any error messages or indications of network 8. Label the node: Let's add the node name equals CRC label to our node to
related problems. resolve this.
3. Check connectivity between pods: 9. oc label node crc nodeName=crc
4. oc exec -it <pod-1> -- ping <pod-2-IP> 10. Check pod again:
5. Additionally, you can use network diagnostic tools like ping, traceroute or 11. oc get pods
telnet to test connectivity
6. between pods or external endpoints. : oc exec my-pod –ping another-pod → Pod now shows Running ✅
7.
8. Use tools like: Oc describe pod nginx
o traceroute
o telnet
o curl
9. Verify network policies:
10. oc get networkpolicy -A $ Lesson Takeaways
Issue Type Useful Commands Fix
Container crash oc logs, oc describe pod Check logs, fix image/config
- 5. Demo: Troubleshooting Pod Scheduling (NodeSelector Example)
Resource limit oc adm top pods Adjust limits
- Scenario Pod pending oc describe pod Fix selector / resources
Pod evicted oc get events Add resources, check node
A new app is created with a nodeSelector condition, but no node matches it → Pod remains etcd issues etcdctl endpoint health Monitor health, logs
in Pending state.
Network issues oc exec ping, oc describe Fix network policies

' Demo Steps ✅ Summary


Oc get pods • Use logs + describe + events for root-cause diagnosis.
we'll create a new application using the OC new app command and specify a node • Monitor nodes, etcd, and network continuously.
selector • Understand pod lifecycle to troubleshoot effectively.
condition that requires the label node name equals CRC. • Practice real scenarios like Pending, CrashLoopBackOff, Evicted, and
Terminating pods.
1. Create an application with node selector: The commands "oc get nodes", "oc adm top nodes", and "oc describe node" are all
2. oc run nginx –-image=bitnami/nginx -–overrides=’{“spec”: {“nodeSelector”: useful for assessing the health of nodes in an OpenShift cluster. "oc get nodes"
{“nodename”: crc”}}}’ provides a general overview of node status, "oc adm top nodes" shows resource
3. oc new-app nginx --dry-run=client -o yaml > [Link]
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
Add in [Link]:
routes -n openshift-console" lists the routes in the openshift-console namespace,
spec: which includes the route for accessing the web console.
template:
spec:
nodeSelector:
nodeName: CRC

Then apply: ) Lecture Notes: Using Product Documentation in


oc apply -f [Link] OpenShift
4. Check pod status: " Objective
5. oc get pods

→ Pod shows Pending.


Learn how to effectively access, navigate, and utilize OpenShift product documentation to Section Description
understand features, troubleshoot issues, and stay updated with new releases. Security RBAC, authentication, and compliance
Backup & Restore Disaster recovery and data protection

( 1. Importance of Documentation
⚙ 4. Example: Creating and Deploying an Application
As an OpenShift administrator, the official product documentation is your go-to guide for:
$ Step 1: Create a New Project
• Understanding platform features
• Learning installation, configuration, and management • Go to the Developer Activities section
• Troubleshooting issues • Locate Work with Projects → Open it in a new tab
• Exploring best practices and new capabilities • Follow the guide to:
o Create a new project (Web Console or CLI)
% The documentation is continuously updated with every new release. o Set access permissions
o View or delete projects

+ Each step includes screenshots and detailed explanations.


* 2. Accessing the Official Documentation
Primary Source:
% Step 2: Deploy a New Application
* [Link]
• From Developer Activities, open Creating Applications using Developer
• Central hub for Red Hat OpenShift Container Platform docs
Perspective
• Contains:
• Explore multiple deployment options:
o Installation guides
o Quickstarts
o Configuration steps
o Import existing codebase
o Administration procedures
o Deploy from container image
o Developer workflows
o Release notes
Example Topics Covered:
Steps to Access:
• YAML examples for configurations
• Customizing sample manifests
1. Visit [Link]
• Environment variable setup
2. Select your OpenShift version from the dropdown (OCP section)
• Common troubleshooting tips
3. Browse through the structured sidebar for relevant topics
, Tip: Note down best practices and recommendations for smoother deployments.

+ 3. Navigating the Documentation Structure


, 5. Command Line Documentation Access
# Main Sections
OpenShift CLI (oc) provides inline help and documentation for quick reference.
Section Description
Getting Started Introductory guide for new users Command Purpose Example
Architecture Explains core OpenShift components Displays general or subcommand
oc help oc help get
Installation Step-by-step platform setup help
Post-installation Configuration Cluster customization, access control oc <command> -h
Shows usage and flags for a oc new-app -h
Application Management Creating and deploying applications command
Operators Managing lifecycle of services oc explain Explains fields and specs of a oc explain
<resource> resource [Link]
Networking & Storage Connectivity and persistent data handling
Displays OC client and cluster
Monitoring & Logging Observing cluster performance and logs oc version 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.

You might also like