OpenShift Analyze a Pod Recipe

  1. Ensure you're logged in with oc
  2. Find the relevant pod(s):
    $ oc get pods -o wide -n $PROJECT
    NAME   READY   STATUS    RESTARTS   AGE     IP    NODE   NOMINATED NODE   READINESS GATES
    $POD   1/1     Running   0          4m46s   ...   ...    <none>           <none>
  3. Display CPU and memory statistics:
    $ oc adm top pods $POD -n $PROJECT
    NAME   CPU(cores)   MEMORY(bytes)   
    $POD   5m           186Mi
  4. Display events in the pod (as well as the node it's on, labels, etc.):
    $ oc describe pod $POD -n $PROJECT
    Name:         ...
    Namespace:    ...
    Priority:     0
    Node:         .../...
    Start Time:   Mon, 15 Feb 2021 12:36:57 -0800
    Labels:       deployment=...
                  pod-template-hash=7d57d6599f
    [...]
    Events:
    Type    Reason          Age   From               Message
    ----    ------          ----  ----               -------
    Normal  Scheduled       21m   default-scheduler  Successfully assigned ... to ...
    Normal  AddedInterface  21m   multus             Add eth0 [...]
    Normal  Pulling         21m   kubelet            Pulling image "image-registry.openshift-image-registry.svc:5000/..."
    Normal  Pulled          21m   kubelet            Successfully pulled image "image-registry.openshift-image-registry.svc:5000/..."
    Normal  Created         21m   kubelet            Created container ...
    Normal  Started         21m   kubelet            Started container ...
  5. Display the pod's stdout logs:
    $ oc logs $POD -n $PROJECT 
    Launching defaultServer (Open Liberty 21.0.0.1/wlp-1.0.48.cl210120210113-1459) on Eclipse OpenJ9 VM, version 1.8.0_282-b08 (en_US)
    [...]
  6. If needed, remote into the pod
  7. If required diagnostic utilities aren't available within a container, you may build and run a debug pod on the node with those utilities.