Bug 1909289 - oc debug of an init container no longer works
Summary: oc debug of an init container no longer works
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.5
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 4.7.0
Assignee: Clayton Coleman
QA Contact: zhou ying
Depends On:
Blocks: 1913109
TreeView+ depends on / blocked
Reported: 2020-12-18 20:29 UTC by Clayton Coleman
Modified: 2021-02-24 15:47 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: InitContainer support was lost during changes to oc debug command. Consequence: It is not possible to debug init containers. Fix: Add support for init containers in oc debug command. Result: It is possible to oc debug init container.
Clone Of:
Last Closed: 2021-02-24 15:47:16 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github openshift oc pull 676 0 None closed Bug 1909289: Should be able to debug an init container 2021-02-01 11:09:50 UTC
Red Hat Product Errata RHSA-2020:5633 0 None None None 2021-02-24 15:47:59 UTC

Description Clayton Coleman 2020-12-18 20:29:29 UTC
Sometime in last few releases init containers stopped being debuggable with `oc debug pod/foo -c <init_container_name>`.  The root cause is the wait logic for the pod container to be running ignores init containers.

The fix is to adjust the wait logic to correctly read init containers. Also, I simplified and removed some logic that was subject to exiting early on errors that might be transient (for instance, the first image pull can fail and the second can succeed) and replaced those with warning messages.

May need a backport for 4.6.

Comment 1 Nick Stielau 2021-01-04 20:10:14 UTC
Sounds like this is a regression but not a new one.  Moving to blocker- to denote that we won't block the release on this.

Comment 3 zhou ying 2021-01-07 01:56:56 UTC
Confirmed with latest oc client, can't reproduce the issue now:

[root@dhcp-140-138 ~]# oc version --client -o yaml 
  buildDate: "2021-01-06T04:18:42Z"
  compiler: gc
  gitCommit: d69d7c45db12728241a16411bf81d534fbcad7c4
  gitTreeState: clean
  gitVersion: 4.7.0-202101060325.p0-d69d7c4
  goVersion: go1.15.5
  major: ""
  minor: ""
  platform: linux/amd64

[root@dhcp-140-138 ~]# oc debug  po/openshift-kube-scheduler-ip-1xxxx.compute.internal -c wait-for-host-port
If you don't see a command prompt, try pressing enter.
sh-4.4# exit

Removing debug pod ...

Comment 6 errata-xmlrpc 2021-02-24 15:47:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.