+++ 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.
Confirmed with the latest oc client, the issue has fixed:
[root@dhcp-140-138 ~]# oc version -oyaml
[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: 10.128.2.19
If you don't see a command prompt, try pressing enter.
[root@dhcp-140-138 ~]# oc describe po/myapp-pod-debug -n zhouy
Start Time: Wed, 11 Dec 2019 21:26:42 +0800
Annotations: debug.openshift.io/source-container: init-mydb
debug.openshift.io/source-resource: /v1, Resource=pods/myapp-pod
[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).
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.