Skip to content

Instantly share code, notes, and snippets.

@javierprovecho
Last active August 18, 2019 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javierprovecho/d1ece672e8deb4cfe519c0d4f57cc3a7 to your computer and use it in GitHub Desktop.
Save javierprovecho/d1ece672e8deb4cfe519c0d4f57cc3a7 to your computer and use it in GitHub Desktop.
Following twitter thread about running kube-web-view in k8spin https://twitter.com/AngelBarrera92/status/1162649686588690437?s=20

Following twitter thread about running kube-web-view in k8spin: https://twitter.com/AngelBarrera92/status/1162649686588690437?s=20

  1. Get a VM
  2. Install Docker
    curl -sSL https://get.docker.com/ | sh
    
  3. Install gvisor (following official guide https://gvisor.dev/docs/user_guide/docker/#install-gvisor) 3.1 Run the following script
      (
        set -e 
        wget https://storage.googleapis.com/gvisor/releases/nightly/latest/runsc
        wget https://storage.googleapis.com/gvisor/releases/nightly/latest/runsc.sha512
        sha512sum -c runsc.sha512
        sudo mv runsc /usr/local/bin
        sudo chown root:root /usr/local/bin/runsc
        chmod 0755 /usr/local/bin/runsc
      )
    
    3.2 Add this configuration to "/etc/docker/daemon.json"
      {
          "runtimes": {
              "runsc": {
                  "path": "/usr/local/bin/runsc"
              }
          }
      }
    
    3.3 Restart Docker
  4. Run a shell in kube-web-view image 4.1 with gVisor
    docker run -it -u $(id -u) -v $PWD/kubeconfig.json:/root/.kube/config --cpus="0.1" --runtime=runsc --entrypoint bash hjacobs/kube-web-view 
    
    4.2 without gVisor
    docker run -it -u $(id -u) -v $PWD/kubeconfig.json:/root/.kube/config --cpus="0.1" --entrypoint bash hjacobs/kube-web-view 
    
  5. Execute the following commands on each container 5.1 Install "strace"
    apt update -qq && apt install -qqy strace
    
    5.2 Get a sys call summary
    time strace -c -w -S name /usr/local/bin/python -m kube_web --help
    
    5.3 Get a full sys call dump
    time strace -o dump -ff /usr/local/bin/python -m kube_web --help
    
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
0.01 0.000074 73 1 1 access
0.00 0.000062 61 1 arch_prctl
0.00 0.000058 57 1 1 bind
0.27 0.003735 65 57 brk
4.44 0.060698 84 715 close
0.01 0.000168 55 3 dup
0.10 0.001338 1338 1 execve
0.00 0.000048 47 1 fcntl
4.55 0.062091 54 1141 fstat
0.03 0.000477 47 10 futex
0.01 0.000075 75 1 getcwd
21.95 0.299758 3188 94 getdents64
0.00 0.000042 41 1 getegid
0.00 0.000045 45 1 geteuid
0.00 0.000042 42 1 getgid
0.01 0.000105 105 1 getpid
0.03 0.000392 65 6 getrandom
0.00 0.000042 42 1 getuid
0.05 0.000641 53 12 2 ioctl
1.69 0.023034 53 433 lseek
3.09 0.042247 99 423 mmap
0.45 0.006138 90 68 mprotect
0.01 0.000181 181 1 mremap
1.09 0.014947 112 133 munmap
23.96 0.327229 372 879 168 openat
0.00 0.000062 62 1 prlimit64
4.23 0.057755 63 914 read
0.05 0.000631 210 3 1 readlink
14.10 0.192597 1218 158 rename
0.32 0.004361 64 68 rt_sigaction
0.00 0.000068 67 1 rt_sigprocmask
0.00 0.000066 65 1 1 set_robust_list
0.00 0.000059 59 1 set_tid_address
0.01 0.000174 57 3 sigaltstack
0.01 0.000075 74 1 socket
18.13 0.247588 108 2272 183 stat
0.01 0.000071 70 1 1 statfs
0.01 0.000146 145 1 sysinfo
0.01 0.000098 97 1 uname
1.35 0.018479 116 159 write
------ ----------- ----------- --------- --------- ----------------
100.00 1.365897 7571 358 total
real 0m3.377s
user 0m1.820s
sys 0m0.930s
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
0.01 0.000074 73 1 1 access
0.01 0.000056 56 1 arch_prctl
0.01 0.000070 70 1 1 bind
0.62 0.003909 72 54 brk
6.33 0.040039 72 556 close
0.02 0.000133 44 3 dup
0.19 0.001232 1231 1 execve
0.01 0.000080 80 1 fcntl
8.46 0.053513 54 981 fstat
0.09 0.000562 56 10 futex
0.01 0.000059 59 1 getcwd
6.42 0.040614 432 94 getdents64
0.01 0.000040 40 1 getegid
0.01 0.000041 40 1 geteuid
0.01 0.000040 39 1 getgid
0.01 0.000049 49 1 getpid
0.07 0.000413 68 6 getrandom
0.01 0.000041 40 1 getuid
0.10 0.000608 50 12 2 ioctl
3.70 0.023367 54 432 lseek
6.89 0.043581 119 366 mmap
0.98 0.006209 91 68 mprotect
1.36 0.008624 112 77 munmap
27.41 0.173301 307 563 11 openat
0.01 0.000057 57 1 prlimit64
9.87 0.062428 68 913 read
0.09 0.000588 196 3 1 readlink
0.49 0.003084 45 68 rt_sigaction
0.01 0.000054 53 1 rt_sigprocmask
0.01 0.000064 64 1 1 set_robust_list
0.01 0.000042 42 1 set_tid_address
0.03 0.000196 65 3 sigaltstack
0.01 0.000095 94 1 socket
26.58 0.168027 85 1956 183 stat
0.01 0.000053 52 1 1 statfs
0.02 0.000154 154 1 sysinfo
0.02 0.000110 110 1 uname
0.10 0.000640 639 1 write
------ ----------- ----------- --------- --------- ----------------
100.00 0.632249 6185 201 total
real 0m2.047s
user 0m1.300s
sys 0m0.550s
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
0.02 0.000029 28 1 1 access
0.01 0.000021 20 1 arch_prctl
0.01 0.000012 12 1 1 bind
0.80 0.001390 24 57 brk
7.18 0.012481 17 715 close
0.04 0.000075 25 3 dup
0.13 0.000231 231 1 execve
0.01 0.000020 19 1 fcntl
10.82 0.018811 16 1141 fstat
0.10 0.000169 16 10 futex
0.01 0.000026 26 1 getcwd
1.64 0.002857 30 94 getdents64
0.02 0.000026 26 1 getegid
0.01 0.000026 26 1 geteuid
0.02 0.000026 26 1 getgid
0.01 0.000017 17 1 getpid
0.10 0.000174 29 6 getrandom
0.01 0.000026 25 1 getuid
0.19 0.000330 27 12 2 ioctl
3.71 0.006454 14 431 3 lseek
5.31 0.009230 21 431 mmap
0.90 0.001559 22 68 mprotect
0.02 0.000027 26 1 mremap
2.86 0.004968 35 141 munmap
17.14 0.029800 33 879 168 openat
0.01 0.000020 19 1 prlimit64
9.48 0.016487 17 917 read
0.04 0.000067 22 3 1 readlink
3.23 0.005616 35 158 rename
0.69 0.001204 17 68 rt_sigaction
0.01 0.000020 19 1 rt_sigprocmask
0.01 0.000020 20 1 set_robust_list
0.01 0.000019 19 1 set_tid_address
0.03 0.000044 14 3 sigaltstack
0.97 0.001692 1691 1 socket
30.45 0.052949 23 2272 183 stat
0.01 0.000017 16 1 1 statfs
0.01 0.000021 20 1 sysinfo
3.97 0.006907 43 159 write
------ ----------- ----------- --------- --------- ----------------
100.00 0.173865 7587 360 total
real 0m1.068s
user 0m0.730s
sys 0m0.291s
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
0.03 0.000035 35 1 1 access
0.02 0.000022 21 1 arch_prctl
0.01 0.000020 19 1 1 bind
1.02 0.001427 26 54 brk
7.86 0.011050 19 556 close
0.05 0.000064 21 3 dup
0.15 0.000209 208 1 execve
0.01 0.000020 20 1 fcntl
13.13 0.018450 18 981 fstat
0.13 0.000176 17 10 futex
0.01 0.000018 18 1 getcwd
2.29 0.003214 34 94 getdents64
0.01 0.000018 18 1 getegid
0.02 0.000032 31 1 geteuid
0.02 0.000032 32 1 getgid
0.01 0.000020 20 1 getpid
0.15 0.000216 36 6 getrandom
0.01 0.000018 18 1 getuid
0.22 0.000305 25 12 2 ioctl
5.48 0.007702 17 430 3 lseek
5.81 0.008165 23 354 mmap
1.16 0.001627 23 68 mprotect
1.19 0.001670 25 65 munmap
11.00 0.015463 27 563 11 openat
0.02 0.000022 22 1 prlimit64
14.81 0.020804 22 916 read
0.08 0.000115 38 3 1 readlink
1.00 0.001399 20 68 rt_sigaction
0.02 0.000022 22 1 rt_sigprocmask
0.02 0.000022 21 1 set_robust_list
0.03 0.000039 38 1 set_tid_address
0.05 0.000072 23 3 sigaltstack
0.03 0.000036 35 1 socket
33.82 0.047517 24 1956 183 stat
0.01 0.000017 17 1 1 statfs
0.02 0.000022 21 1 sysinfo
0.32 0.000457 456 1 write
------ ----------- ----------- --------- --------- ----------------
100.00 0.140520 6161 203 total
real 0m0.681s
user 0m0.378s
sys 0m0.268s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment