1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00

CQA for Using Pods

This commit is contained in:
Steven Smith
2025-08-28 08:03:12 -04:00
committed by openshift-cherrypick-robot
parent c16022defe
commit 3d042c73b4
7 changed files with 91 additions and 129 deletions

View File

@@ -1,13 +0,0 @@
// Module included in the following assemblies:
//
// * nodes/nodes-pods-using.adoc
:_mod-docs-content-type: CONCEPT
[id="nodes-pods-about_{context}"]
= About pods
{product-title} leverages the Kubernetes concept of a _pod_, which is one or more containers deployed
together on one host, and the smallest compute unit that can be defined,
deployed, and managed. Pods are the rough equivalent of a machine instance (physical or virtual) to a container.
You can view a list of pods associated with a specific project or view usage statistics about pods.

View File

@@ -6,27 +6,18 @@
[id="nodes-pods-viewing-project_{context}"]
= Viewing pods in a project
You can view a list of pods associated with the current project, including the number of replica, the current status, number or restarts and the age of the pod.
You can display pod usage statistics, such as CPU, memory, and storage consumption, to monitor container runtime environments and ensure efficient resource use.
.Procedure
To view the pods in a project:
. Change to the project:
. Change to the project by entering the following command:
+
[source,terminal]
----
$ oc project <project-name>
$ oc project <project_name>
----
. Run the following command:
+
[source,terminal]
----
$ oc get pods
----
+
For example:
. Obtain a list of pods by entering the following command:
+
[source,terminal]
----
@@ -40,8 +31,8 @@ NAME READY STATUS RESTARTS AGE
console-698d866b78-bnshf 1/1 Running 2 165m
console-698d866b78-m87pm 1/1 Running 2 165m
----
+
Add the `-o wide` flags to view the pod IP address and the node where the pod is located.
. Optional: Add the `-o wide` flags to view the pod IP address and the node where the pod is located. For example:
+
[source,terminal]
----

View File

@@ -13,25 +13,15 @@ storage consumption.
.Prerequisites
* You must have `cluster-reader` permission to view the usage statistics.
* Metrics must be installed to view the usage statistics.
.Procedure
To view the usage statistics:
. Run the following command:
. View the usage statistics by entering the following command:
+
[source,terminal]
----
$ oc adm top pods
----
+
For example:
+
[source,terminal]
----
$ oc adm top pods -n openshift-console
$ oc adm top pods -n <namespace>
----
+
.Example output
@@ -44,18 +34,9 @@ downloads-594fcccf94-bcxk8 3m 18Mi
downloads-594fcccf94-kv4p6 2m 15Mi
----
. Run the following command to view the usage statistics for pods with labels:
. Optional: Add the `--selector=''` label to view usage statistics for pods with labels. Note that you must choose the label query to filter on, such as `=`, `==`, or `!=`. For example:
+
[source,terminal]
----
$ oc adm top pod --selector=''
----
+
You must choose the selector (label query) to filter on. Supports `=`, `==`, and `!=`.
+
For example:
+
[source,terminal]
----
$ oc adm top pod --selector='name=my-pod'
$ oc adm top pod --selector='<pod_name>'
----

View File

@@ -7,71 +7,4 @@
[id="viewing-resource-logs-cli-console_{context}"]
= Viewing resource logs
You can view the log for various resources in the {oc-first} and web console. Logs read from the tail, or end, of the log.
.Prerequisites
* Access to the {oc-first}.
.Procedure (UI)
. In the {product-title} console, navigate to *Workloads* -> *Pods* or navigate to the pod through the resource you want to investigate.
+
[NOTE]
====
Some resources, such as builds, do not have pods to query directly. In such instances, you can locate the *Logs* link on the *Details* page for the resource.
====
. Select a project from the drop-down menu.
. Click the name of the pod you want to investigate.
. Click *Logs*.
.Procedure (CLI)
** View the log for a specific pod:
+
[source,terminal]
----
$ oc logs -f <pod_name> -c <container_name>
----
+
--
where:
`-f`:: Optional: Specifies that the output follows what is being written into the logs.
`<pod_name>`:: Specifies the name of the pod.
`<container_name>`:: Optional: Specifies the name of a container. When a pod has more than one container, you must specify the container name.
--
+
For example:
+
[source,terminal]
----
$ oc logs ruby-58cd97df55-mww7r
----
+
[source,terminal]
----
$ oc logs -f ruby-57f7f4855b-znl92 -c ruby
----
+
The contents of log files are printed out.
** View the log for a specific resource:
+
[source,terminal]
----
$ oc logs <object_type>/<resource_name> <1>
----
<1> Specifies the resource type and name.
+
For example:
+
[source,terminal]
----
$ oc logs deployment/ruby
----
+
The contents of log files are printed out.
You can view logs for resources in the OpenShift CLI (oc) or web console. Logs display from the end (or tail) by default. Viewing logs for resources can help you troubleshoot issues and monitor resource behavior.

View File

@@ -0,0 +1,52 @@
// Module included in the following assemblies:
//
// * observability/logging/log_visualization/log-visualization.adoc
// * nodes/pods/nodes-pods-viewing.adoc
:_mod-docs-content-type: PROCEDURE
[id="viewing-resource-logs-cli_{context}"]
= Viewing resource logs by using the CLI
Use the following procedure to view resource logs by using the command-line interface (CLI).
.Prerequisites
* Access to the {oc-first}.
.Procedure
* View the log for a specific pod by entering the following command:
+
[source,terminal]
----
$ oc logs -f <pod_name> -c <container_name>
----
+
--
where:
`-f`:: Optional: Specifies that the output follows what is being written into the logs.
`<pod_name>`:: Specifies the name of the pod.
`<container_name>`:: Optional: Specifies the name of a container. When a pod has more than one container, you must specify the container name.
--
+
For example:
+
[source,terminal]
----
$ oc logs -f ruby-57f7f4855b-znl92 -c ruby
----
* View the log for a specific resource by entering the following command:
+
[source,terminal]
----
$ oc logs <object_type>/<resource_name>
----
+
For example:
+
[source,terminal]
----
$ oc logs deployment/ruby
----

View File

@@ -0,0 +1,25 @@
// Module included in the following assemblies:
//
// * observability/logging/log_visualization/log-visualization.adoc
// * nodes/pods/nodes-pods-viewing.adoc
:_mod-docs-content-type: PROCEDURE
[id="viewing-resource-logs-console_{context}"]
= Viewing resource logs by using the web console
Use the following procedure to view resource logs by using the {product-title} web console.
.Procedure
. In the {product-title} console, navigate to *Workloads* -> *Pods* or navigate to the pod through the resource you want to investigate.
+
[NOTE]
====
Some resources, such as builds, do not have pods to query directly. In such instances, you can locate the *Logs* link on the *Details* page for the resource.
====
. Select a project from the drop-down menu.
. Click the name of the pod you want to investigate.
. Click *Logs*.

View File

@@ -6,19 +6,12 @@ include::_attributes/common-attributes.adoc[]
toc::[]
As an administrator, you can view the pods in your cluster and to determine the health of those pods and the cluster as a whole.
include::modules/nodes-pods-about.adoc[leveloffset=+1]
// The following include statements pull in the module files that comprise
// the assembly. Include any combination of concept, procedure, or reference
// modules required to cover the user story. You can also include other
// assemblies.
As an administrator, you can view cluster pods, check their health, and evaluate the overall health of the cluster. You can also view a list of pods associated with a specific project or view usage statistics about pods. Regularly viewing pods can help you detect problems early, track resource usage, and ensure cluster stability.
include::modules/nodes-pods-viewing-project.adoc[leveloffset=+1]
include::modules/nodes-pods-viewing-usage.adoc[leveloffset=+1]
include::modules/viewing-resource-logs-cli-console.adoc[leveloffset=+1]
include::modules/viewing-resource-logs-console.adoc[leveloffset=+2]
include::modules/viewing-resource-logs-cli.adoc[leveloffset=+2]