Bug 1779331 - oc debug init container on hostnetwork / hostpid DaemonSet Pod does not work
Summary: oc debug init container on hostnetwork / hostpid DaemonSet Pod does not work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.4.0
Assignee: Clayton Coleman
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks: 1779332
TreeView+ depends on / blocked
 
Reported: 2019-12-03 18:56 UTC by Clayton Coleman
Modified: 2020-05-13 21:53 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1779332 (view as bug list)
Environment:
Last Closed: 2020-05-13 21:53:53 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 166 0 'None' closed Bug 1779331: Fix a number of issues around debugging daemonset pods and init containers 2021-01-27 10:55:30 UTC
Red Hat Product Errata RHBA-2020:0581 0 None None None 2020-05-13 21:53:55 UTC

Description Clayton Coleman 2019-12-03 18:56:28 UTC
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-16 03:05:45 UTC
Confirmed with latest oc client, the issue has fixed:

[root@dhcp-140-138 ~]# oc version -o yaml 
clientVersion:
  buildDate: "2019-12-13T16:45:38Z"
  compiler: gc
  gitCommit: 60ccef2e295e103fa6bd01b9ae5de9061386b948
  gitTreeState: clean
  gitVersion: v4.4.0
  goVersion: go1.12.12
  major: ""
  minor: ""
  platform: linux/amd64


[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).

[root@dhcp-140-138 ~]# oc debug po/myapp-pod -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.15
If you don't see a command prompt, try pressing enter.

/ # 


[root@dhcp-140-138 ~]# oc get po 
NAME              READY   STATUS     RESTARTS   AGE
myapp-pod         1/1     Running    0          2m5s
myapp-pod-debug   0/1     Init:0/1   0          36s
[root@dhcp-140-138 ~]# oc describe po/myapp-pod-debug
Name:         myapp-pod-debug
Namespace:    zhouyt
Priority:     0
....
Init Containers:
  init-mydb:
    Container ID:  cri-o://4bb5485a944d423bf860037f4b953ca48b2a262dbe911da4486503476e7a2fc1
    Image:         busybox:1.28
    Image ID:      docker.io/library/busybox@sha256:141c253bc4c3fd0a201d32dc1f493bcf3fff003b6df416dea4f41046e0f37d47
    Port:          <none>
    Host Port:     <none>
    Command:
      /bin/sh
    State:          Running
      Started:      Mon, 16 Dec 2019 11:02:08 +0800
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-qj89w (ro)
Containers:
  myapp-container:
    Container ID:  
    Image:         busybox:1.28
    Image ID:      
    Port:          <none>
    Host Port:     <none>
    Command:
      sh
      -c
      echo The app is running! && sleep 3600
    State:          Waiting
      Reason:       PodInitializing
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-qj89w (ro)
Conditions:
  Type              Status
  Initialized       False 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True

Comment 4 errata-xmlrpc 2020-05-13 21:53:53 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.

https://access.redhat.com/errata/RHBA-2020:0581


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