Bug 1779332

Summary: oc debug init container on hostnetwork / hostpid DaemonSet Pod does not work
Product: OpenShift Container Platform Reporter: Clayton Coleman <ccoleman>
Component: ocAssignee: Clayton Coleman <ccoleman>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.3.0CC: aos-bugs, jokerman, mfojtik, yinzhou
Target Milestone: ---   
Target Release: 4.3.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1779331 Environment:
Last Closed: 2020-01-23 11:17:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1779331    
Bug Blocks:    

Description Clayton Coleman 2019-12-03 18:57:00 UTC
+++ This bug was initially created as a clone of Bug #1779331 +++

Init containers were not fully supported in oc debug.  We need to fix that, and also ensure that specific debug options work well with DaemonSet pods.

Comment 2 zhou ying 2019-12-11 13:49:05 UTC
Confirmed with the latest oc client, the issue has fixed:

[root@dhcp-140-138 ~]# oc version -oyaml
  buildDate: "2019-12-06T11:24:15Z"
  compiler: gc
  gitCommit: 3fa38ed2761a75d4c648acfc8ac14df930219ed5
  gitTreeState: clean
  gitVersion: v4.3.0
  goVersion: go1.12.12
  major: ""
  minor: ""
  platform: linux/amd64

[root@dhcp-140-138 ~]# oc debug po/myapp-pod -n zhouy -c init-mydb --keep-init-containers=false
Starting pod/myapp-pod-debug, command was: sh -c until nslookup mydb; do echo waiting for mydb; sleep 2; done;
Pod IP:
If you don't see a command prompt, try pressing enter.
/ # 

[root@dhcp-140-138 ~]# oc describe po/myapp-pod-debug  -n zhouy
Name:         myapp-pod-debug
Namespace:    zhouy
Priority:     0
Node:         ip-10-0-138-96.us-east-2.compute.internal/
Start Time:   Wed, 11 Dec 2019 21:26:42 +0800
Labels:       <none>
Annotations:  debug.openshift.io/source-container: init-mydb
              debug.openshift.io/source-resource: /v1, Resource=pods/myapp-pod
                    "name": "openshift-sdn",
                    "interface": "eth0",
                    "ips": [
                    "dns": {},
                    "default-route": [
              openshift.io/scc: anyuid
Status:       Pending
Init Containers:
    Container ID:  
    Image:         openshift/origin

[root@dhcp-140-138 ~]# oc debug -h
Launch a command shell to debug a running application

      --to-namespace='': Override the namespace to create the pod into (instead of using --namespace).

Comment 4 errata-xmlrpc 2020-01-23 11:17:46 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, and where to find the updated
files, follow the link below.

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