Hide Forgot
Description of problem: Required by PR#10360 Some commands using one of containers need to suggest user `oc describe` to check multiple containers. Version-Release number of selected component (if applicable): oc v3.4.0.16+cc70b72 How reproducible: Always Steps to Reproduce: 1. oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/deployment/dc-with-two-containers.yaml 2. (to compare:) oc exec dctest-1-n9unp -- date Defaulting container name to dctest-1. Use 'oc describe pod/dctest-1-n9unp' to see all of the containers in this pod. Thu Oct 27 06:57:43 UTC 2016 3. Try following commands: oc rsh dctest-1-n9unp date oc rsync /home/xiaocwan/tmp/tmp dctest-2-28d8s:/tmp (need to update image for 1st container: aosqe/scratch:tarrsync) oc logs -f pod/dctest-1-n9unp oc debug dctest-1-n9unp oc attach dctest-1-n9unp Actual results: 3. # oc rsh dctest-1-n9unp date Defaulting container name to dctest-1. Thu Oct 27 06:55:16 UTC 2016 # oc rsync /home/xiaocwan/tmp/tmp dctest-2-28d8s:/tmp (need to update image for 1st container: aosqe/scratch:tarrsync) sending incremental file list tmp/ tmp/test sent 93 bytes received 35 bytes 19.69 bytes/sec total size is 0 speedup is 0.00 Defaulting container name to dctest-1. # oc logs -f pod/dctest-1-n9unp Error from server: a container name must be specified for pod dctest-1-n9unp, choose one of: [dctest-1 dctest-2] # oc debug dctest-1-n9unp Debugging with pod/dctest-1-n9unp-debug, original command: <image entrypoint> Waiting for pod to start ... Pod IP: 10.1.2.54 If you don't see a command prompt, try pressing enter. sh-4.2$ # oc attach dctest-1-n9unp If you don't see a command prompt, try pressing enter. Expected results: 3. Should suggest user to use 'oc describe <pod>' to obtain container names Additional info:
This is still reproduced on OCP 3.7.14 now: Pod with multiple containers is failed to sync file from container, but single container pod could. Created /tmp/test.txt in pod "dctest-1-lh0mf", container 1 "dctest-1" and then do: [xiaocwan@dhcp-141-172 aaa]$ oc rsync -c dctest-1 dctest-1-lh0mf:/tmp/test.txt /home/xiaocwan/tmp/aaa/ WARNING: cannot use rsync: rsync not available in container WARNING: cannot use tar: tar not available in container error: No available strategies to copy. So as to oc attach <multi-container-pod>, it doesn't show which container it uses: $ oc attach dctest-1-lh0mf If you don't see a command prompt, try pressing enter. Started, serving at 8080
oc debug also reproduces on OCP 3.7, there should be a "oc describe" indication and a current running container $ oc debug dctest-1-btzvk Debugging with pod/dctest-1-btzvk-debug, original command: /hello-openshift Waiting for pod to start ... Pod IP: 10.128.0.65 If you don't see a command prompt, try pressing enter. sh-4.2$
Origin PR: https://github.com/openshift/origin/pull/18178
Tested on v3.9.0-0.41.0 pod with multiple containers does suggest the way to get a container by `oc rsh` $ oc rsh dctest-1-jqv8b Defaulting container name to dctest-1. Use 'oc describe pod/dctest-1-jqv8b -n xiaocwan-t' to see all of the containers in this pod. However, not all command in step 3(Try following commands) also needs the clear suggestion message such as: $ oc rsync /home/xiaocwan/tmp/tmp dctest-1-jqv8b:/tmp WARNING: cannot use rsync: rsync not available in container rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\\"tar\\\": executable file not found in $PATH\"\n" WARNING: cannot use tar: tar not available in container error: No available strategies to copy. Could you please help to update them as well, thanks!
Looks like the code in comment 3 doesn't check pod container number=1 or >1. Test result of oc v3.10.0-0.54.0 for pod that only has 1 container: $ oc debug pod/ruby-ex-1-4gxnf -t Defaulting container name to ruby-ex. Use 'oc describe pod/ruby-ex-1-4gxnf-debug -n xxia-proj' to see all of the containers in this pod. ... It should not give the suggestion when there is only 1 container
This was fixed in https://github.com/openshift/origin/pull/21997 moving to qa.
Most commands are fixed on oc v4.0.2 as below but miss one: $ oc exec dctest-1-xd462 -- date Defaulting container name to dctest-1. Use 'oc describe pod/dctest-1-xd462 -n xiaocwan-t' to see all of the containers in this pod. Wed Feb 27 02:42:07 UTC 2019 $ oc rsh dctest-1-xd462 date Defaulting container name to dctest-1. Use 'oc describe pod/dctest-1-xd462 -n xiaocwan-t' to see all of the containers in this pod. Wed Feb 27 02:44:41 UTC 2019 $ oc rsync /home/xiaocwan/tmp/tmp dctest-2-6kv5t:/tmp/ sending incremental file list tmp/ sent 45 bytes received 19 bytes 18.29 bytes/sec total size is 0 speedup is 0.00 Defaulting container name to dctest-1. Use 'oc describe pod/dctest-2-6kv5t -n xiaocwan-t' to see all of the containers in this pod. $ oc debug dctest-2-6kv5t Defaulting container name to dctest-1. Use 'oc describe pod/dctest-2-6kv5t-debug -n xiaocwan-t' to see all of the containers in this pod. $ oc attach dctest-2-6kv5t Defaulting container name to dctest-1. Use 'oc describe pod/ -n xiaocwan-t' to see all of the containers in this pod. If you don't see a command prompt, try pressing enter. running .... Only left one command: $ oc logs -f dctest-2-6kv5t Error from server (BadRequest): a container name must be specified for pod dctest-2-6kv5t, choose one of: [dctest-1 dctest-2] So is this one by design?
> So is this one by design? Yes, the remaining commands have a different logic underneath it, also with recent in kubectl (might not be in oc, yet) changes we'll nicely allow logs from multiple containers. Moving back to qa.
Comment 8 is well explained and could be accepted by user, it could be Verified by 4.1 Thank you all!
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-2019:0758