Chapter 9. Monitoring and Managing Applications on OpenShift

You’ve made an application with multiple components, and you’ve automated its build and deployment with a repeatable pipeline. You’ve set up OpenShift to watch your applications and take action on your behalf when they need to be scaled in response to demand or restarted in response to their going sideways. You’re in a good position to focus on your application’s features and code, because when everything goes right, you commit changes and OpenShift handles the rest.

But no one defies Murphy’s Law forever. Eventually you’ll need to troubleshoot your application, or its deployment, by examining its moving parts, available cluster resources, and the logs that record build, deployment, and application events. This chapter introduces the most common OpenShift tools for examining running resources, from listing them to check their basic status, to walking in your application’s shoes by connecting to it and interactively running commands inside its container.

Listing and Detailing Resources

The oc tool is the simplest form of monitoring OpenShift resources. There is a general pattern for addressing a resource in an oc command line. You specify the action you want to do, the kind of object you want to do it to, and the name of that specific object: oc <verb> <kind> <name>. Specifying a kind but not a name refers to all the objects of that kind.

For example, to list all the objects of the Pod type running in the current project, ...

Get OpenShift for Developers, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.