OpenShift Pod Operations: Difference between revisions
(28 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
* [[OpenShift_Operations#Subjects|OpenShift Operations]] | * [[OpenShift_Operations#Subjects|OpenShift Operations]] | ||
* [[OpenShift Application Operations#Overview|Application Operations]] | |||
* [[OpenShift Pod Concepts#Overview|OpenShift Pod Concepts]] | |||
=List Pods for a Project= | |||
oc get projects | |||
oc get -n <''project-name''> pods | |||
=List Pods on Nodes= | =List Pods on Nodes= | ||
Line 13: | Line 21: | ||
=Pod Status= | =Pod Status= | ||
oc [-n ''<project-name>''] [[oc get#pods|get pods]] | The most complete information set is generated by "oc get -o yaml pod ..." and "oc describe pod ...": | ||
oc [-n ''<project-name>''] [[oc get#pods|get pods] | |||
oc [-n ''<project-name>''] -o yaml [[oc get#pod|get pod]]] ''<pod-name>'' | |||
oc [-n ''<project-name>''] [[Oc_describe#pod|describe]] pod ''<pod-name>'' | oc [-n ''<project-name>''] [[Oc_describe#pod|describe]] pod ''<pod-name>'' | ||
oc [-n ''<project-name>''] [[Oc_describe#pod|describe]] pod/''<pod-name>'' | oc [-n ''<project-name>''] [[Oc_describe#pod|describe]] pod/''<pod-name>'' | ||
oc [-n ''<project-name>''] [[Oc_edit#Generic_Syntax|edit]] pod/''<pod-name>'' | oc [-n ''<project-name>''] [[Oc_edit#Generic_Syntax|edit]] pod/''<pod-name>'' | ||
=Monitor Pod's Logs= | |||
[[oc logs]] -f <''pod-name''> | |||
=Execute Commands in Containers= | |||
[[oc rsh]] <''pod-id''> <''command''> | |||
=Deploy a Simple Pod that Allows Arbitrary Commands in a Project= | |||
{{Internal|OpenShift Simple Pod Running inside an OpenShift Project|Simple Pod Running inside an OpenShift Project}} | |||
=Update a Pod Defintion= | =Update a Pod Defintion= | ||
Line 27: | Line 50: | ||
The controller (either [[OpenShift_Concepts#Replication_Controller|replication]] or [[OpenShift_Concepts#DaemonSet|DamonSet]]) will detect that the pod is missing and it will start a new one. | The controller (either [[OpenShift_Concepts#Replication_Controller|replication]] or [[OpenShift_Concepts#DaemonSet|DamonSet]]) will detect that the pod is missing and it will start a new one. | ||
=Evacuate Pods from Node= | |||
{{External|https://docs.openshift.com/container-platform/latest/admin_guide/manage_nodes.html#evacuating-pods-on-nodes}} | |||
Only pods backed by [[OpenShift Concepts#Replication_Controller|replication controllers]] can be evacuated. The [[OpenShift_Concepts#Bare_Pod|"bare" pods]] cannot be evacuated. | |||
Drain the node. | |||
[[oadm drain]] <''node-name''> [--delete-local-data] [--ignore-daemonsets] [--force] | |||
oadm drain node2 --delete-local-data --ignore-daemonsets | |||
Use --delete-local-data if there are pods with local storage - such as Maven build pods. | |||
Use --ignore-daemonset if there are ignore DaemonSets: If there are DaemonSet-managed pods, drain will not proceed without --ignore-daemonsets, and regardless it will not delete any DaemonSet-managed pods, because those pods would be immediately replaced by the DaemonSet controller, which ignores unschedulable markings. | |||
oadm manage-node --evacuate is deprecated. | |||
=Scaling Down and Up the Number of Replicas associated with a DeploymentConfig= | |||
{{Internal|OpenShift_Application_Operations#Scaling_Up_and_Down_the_Number_of_Replicas_associated_with_a_DeploymentConfig|Application Operations - Scaling Up and Down the Number of Replicas associated with a DeploymentConfig}} |
Latest revision as of 01:22, 28 February 2018
External
Internal
List Pods for a Project
oc get projects oc get -n <project-name> pods
List Pods on Nodes
oadm manage-node <node-name> --list-pods
Pod Status
The most complete information set is generated by "oc get -o yaml pod ..." and "oc describe pod ...":
oc [-n <project-name>] [[oc get#pods|get pods] oc [-n <project-name>] -o yaml get pod] <pod-name> oc [-n <project-name>] describe pod <pod-name> oc [-n <project-name>] describe pod/<pod-name> oc [-n <project-name>] edit pod/<pod-name>
Monitor Pod's Logs
oc logs -f <pod-name>
Execute Commands in Containers
oc rsh <pod-id> <command>
Deploy a Simple Pod that Allows Arbitrary Commands in a Project
Update a Pod Defintion
Stopping Pods
A pod can be stopped by deleting its associated "pod" object:
oc delete pod/logging-fluentd-3kz30
The controller (either replication or DamonSet) will detect that the pod is missing and it will start a new one.
Evacuate Pods from Node
Only pods backed by replication controllers can be evacuated. The "bare" pods cannot be evacuated.
Drain the node.
oadm drain <node-name> [--delete-local-data] [--ignore-daemonsets] [--force]
oadm drain node2 --delete-local-data --ignore-daemonsets
Use --delete-local-data if there are pods with local storage - such as Maven build pods.
Use --ignore-daemonset if there are ignore DaemonSets: If there are DaemonSet-managed pods, drain will not proceed without --ignore-daemonsets, and regardless it will not delete any DaemonSet-managed pods, because those pods would be immediately replaced by the DaemonSet controller, which ignores unschedulable markings.
oadm manage-node --evacuate is deprecated.