Disabling network logs on Kubernetes when running kubectl exec
Asked Answered
S

3

23

Runnning kubectl exec -it <PODNAME> -- /bin/bash is printing a lot of trash of the shell:

) Data frame handling
                     I0331 17:46:15.486652    3807 logs.go:41] (0xc4201158c0) Data frame received for 5
                                                                                                       I0331 17:46:15.486671    3807 logs.go:41] (0xc42094a000) (5) Data frame handling
                                                                                                                                                                                       I0331 17:46:15.486682    3807 logs.go:41] (0xc42094a000) (5) Data frame sent
                                                                                                                                                                                                                                                                   root@hello-node-2399519400-6q6s3:/# I0331 17:46:16.667823    3807 logs.go:41] (0xc420687680) (3) Writing data frame
                                                  I0331 17:46:16.669223    3807 logs.go:41] (0xc4201158c0) Data frame received for 5
                                                                                                                                    I0331 17:46:16.669244    3807 logs.go:41] (0xc42094a000) (5) Data frame handling
                                                                                                                                                                                                                    I0331 17:46:16.669254    3807 logs.go:41] (0xc42094a000) (5) Data frame sent

root@hello-node-2399519400-6q6s3:/# I0331 17:46:17.331753    3807 logs.go:41] (0xc420687680) (3) Writing data frame
                                                                                                                   I0331 17:46:17.333338    3807 logs.go:41] (0xc4201158c0) Data frame received for 5
                                                                                                                                                                                                     I0331 17:46:17.333358    3807 logs.go:41] (0xc42094a000) (5) Data frame handling
                                                                                                                                                                                                                                                                                     I0331 17:46:17.333369    3807 logs.go:41] (0xc42094a000) (5) Data frame sent

I0331 17:46:17.333922    3807 logs.go:41] (0xc4201158c0) Data frame received for 5
                                                                                  I0331 17:46:17.333943    3807 logs.go:41] (0xc42094a000) (5) Data frame handling
                                                                                                                                                                  I0331 17:46:17.333956    3807 logs.go:41] (0xc42094a000) (5) Data frame sent
                                                                                                                                                                                                                                              root@hello-node-2399519400-6q6s3:/# I0331 17:46:17.738444    3807 logs.go:41] (0xc420687680) (3) Writing data frame
                             I0331 17:46:17.740563    3807 logs.go:41] (0xc4201158c0) Data frame received for 5
                                                                                                               I0331 17:46:17.740591    3807 logs.go:41] (0xc42094a000) (5) Data frame handling
                                                                                                                                                                                               I0331 17:46:17.740606    3807 logs.go:41] (0xc42094a000) (5) Data frame sent

It is a little bit better without 't' option:

kubectl exec -i hello-4103519535-hcdm6 -- /bin/bash
I0331 18:29:06.918584    4992 logs.go:41] (0xc4200878c0) (0xc4204c5900) Create stream
I0331 18:29:06.918714    4992 logs.go:41] (0xc4200878c0) (0xc4204c5900) Stream added, broadcasting: 1
I0331 18:29:06.928571    4992 logs.go:41] (0xc4200878c0) Reply frame received for 1
I0331 18:29:06.928605    4992 logs.go:41] (0xc4200878c0) (0xc4203ffc20) Create stream
I0331 18:29:06.928614    4992 logs.go:41] (0xc4200878c0) (0xc4203ffc20) Stream added, broadcasting: 3
I0331 18:29:06.930565    4992 logs.go:41] (0xc4200878c0) Reply frame received for 3
I0331 18:29:06.930603    4992 logs.go:41] (0xc4200878c0) (0xc4204c59a0) Create stream
I0331 18:29:06.930615    4992 logs.go:41] (0xc4200878c0) (0xc4204c59a0) Stream added, broadcasting: 5
I0331 18:29:06.932455    4992 logs.go:41] (0xc4200878c0) Reply frame received for 5
I0331 18:29:06.932499    4992 logs.go:41] (0xc4200878c0) (0xc420646000) Create stream
I0331 18:29:06.932511    4992 logs.go:41] (0xc4200878c0) (0xc420646000) Stream added, broadcasting: 7
I0331 18:29:06.935363    4992 logs.go:41] (0xc4200878c0) Reply frame received for 7
echo toto
I0331 18:29:08.943066    4992 logs.go:41] (0xc4203ffc20) (3) Writing data frame
I0331 18:29:08.947811    4992 logs.go:41] (0xc4200878c0) Data frame received for 5
I0331 18:29:08.947837    4992 logs.go:41] (0xc4204c59a0) (5) Data frame handling
I0331 18:29:08.947851    4992 logs.go:41] (0xc4204c59a0) (5) Data frame sent
toto

Is there a way to disable that? Would it come from my environment ? I am still not sure if it comes from Kubernetes or my environment actually.

Stereotropism answered 31/3, 2017 at 15:50 Comment(3)
Doesn't work :(Stereotropism
The earlier one was incorrect, try as kubectl exec -it <PODNAME> -- /bin/bash > /dev/null 2>&1Practical
Hum it literally broke my shell :p Nothing responded anymoreStereotropism
S
53

Just found it: unset DEBUG fixed it !

Stereotropism answered 1/4, 2017 at 11:6 Comment(2)
I was setting this inside the pod. But actually we have to set it in the **host machine&& (your machine) from where we are running kubectl execPearson
To clarify, run this: DEBUG= kubectl exec -it <PODNAME> -- /bin/bash This will unset DEBUG before opening a shell.Scanties
M
10

if you are in cmd run:

set DEBUG=

if you are in powershell :

$env:DEBUG=""

if you are a bash-like shell:

export DEBUG= or unset DEBUG

Menjivar answered 12/9, 2018 at 20:12 Comment(0)
F
0

If you are encountering this when running from VS Code terminal the problem may be related to "MongoDB for VS Code" extension.

  • close any open terminals,
  • Disable the extension
  • reload window
Feltner answered 22/12, 2023 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.