wrfly / container-web-tty

Connect your containers via a web-tty
https://container-web-tty.kfd.me/
Apache License 2.0
246 stars 45 forks source link

Connection close #32

Closed vsxen closed 5 years ago

vsxen commented 5 years ago

version: 0.1.8 commit: 50c90a8 date: 2019-03-26 这行貌似应该删掉?另外 kuberctl >> kubectl https://github.com/wrfly/container-web-tty/blob/v0.1.8/container/kube/kuberctl.go#L181 SHELL_LIST 貌似用bash/bin/bash好些? https://github.com/wrfly/container-web-tty/blob/v0.1.8/config/config.go#L5

wrfly commented 5 years ago

Hi, thanks for the issue.

  1. 这个ls是为了检查SHELL_LIST里的文件是否存在的,所以还不能删;但由于十个月以前了,也不知道kubeAPI变了没,有时间我再回归测试一下。
  2. /bin/bash这个是为了先检查目标文件是否存在,如果用bash的话,就检查不出文件存在了:
    // ContainerStatPath returns Stat information about a path inside the container filesystem.
    func (cli *Client) ContainerStatPath(ctx context.Context, containerID, path string) (types.ContainerPathStat, error) {
  3. kuberctl 的确是个typo,等下次修bug的时候改掉

Thanks again.

vsxen commented 5 years ago

是我理解错了 我看kubectl POST是exec?command=bash&container=u&stdin=true&stdout=true&tty=true 这样的

不过确实有问题

DEBU[0006] find cid: 1e49a89511a2
DEBU[0006] get container's shell path, cid: 1e49a89511a2
DEBU[0006] POST to https://x.x.x.x.x:6443/api/v1/namespaces/default/pods/u-69bf7ff58d-99dtx/exec?command=ls&command=%2Fbin%2Fbash&container=u&stdin=false&stdout=true&tty=false
DEBU[0006] container 1e49a89511a2 exist /bin/bash
DEBU[0006] get shell path /bin/bash
[GIN] 2019/04/21 - 14:13:41 | 200 |  105.916078ms | x.x.x.x.x | GET      /exec/1e49a89511a2/
[GIN] 2019/04/21 - 14:13:41 | 200 |     248.994µs | x.x.x.x.x | GET      /css/index.css
[GIN] 2019/04/21 - 14:13:41 | 200 |      140.08µs | x.x.x.x.x | GET      /css/xterm_customize.css
[GIN] 2019/04/21 - 14:13:41 | 200 |      63.775µs | x.x.x.x.x | GET      /auth_token.js
[GIN] 2019/04/21 - 14:13:41 | 200 |     412.717µs | x.x.x.x.x | GET      /css/xterm.css
[GIN] 2019/04/21 - 14:13:41 | 200 |      47.291µs | x.x.x.x.x | GET      /config.js
[GIN] 2019/04/21 - 14:13:41 | 200 |   55.462524ms | x.x.x.x.x | GET      /js/gotty-bundle.js
DEBU[0006] find cid: 1e49a89511a2
INFO[0006] New client connected: x.x.x.x.x:29913, connections: 1
DEBU[0006] exec container: 1e49a89511a2aebec7f18877048def60adbebd03e7d8a762843814cf4b1c9c43, params:
DEBU[0006] exec pod: {1e49a89511a2aebec7f18877048def60adbebd03e7d8a762843814cf4b1c9c43 u ubuntu:18.04  Ready / Running age: 10h21m8s; restart 1 [10.244.0.40 ] /bin/bash u-69bf7ff58d-99dtx u default   {   false}}
DEBU[0006] POST to https://x.x.x.x.x:6443/api/v1/namespaces/default/pods/u-69bf7ff58d-99dtx/exec?command=%2Fbin%2Fbash+-l&container=u&stdin=true&stdout=true&tty=true
DEBU[0006] return enj
DEBU[0006] resize terminal to: 237x53
[GIN] 2019/04/21 - 14:13:41 | 200 |      92.426µs | x.x.x.x.x | GET      /favicon.png
ERRO[0006] exec error: [command terminated with exit code 126]
DEBU[0006] exec done
INFO[0006] Connection closed by backend closed: x.x.x.x.x:29913, connections: 0
[GIN] 2019/04/21 - 14:13:41 | 200 |  147.670107ms | x.x.x.x.x | GET      /exec/1e49a89511a2/ws
E0421 14:13:41.938928      30 v2.go:105] io: read/write on closed pipe
wrfly commented 5 years ago

好,我明天debug一下

wrfly commented 5 years ago

Hi, try this wrfly/container-web-tty:develop

vsxen commented 5 years ago

It's ok. exec 和 log 的UI还有些问题, 建议加上ns 选择