Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一个pod多个容器 #8

Open
FrelDX opened this issue Jul 26, 2019 · 12 comments
Open

一个pod多个容器 #8

FrelDX opened this issue Jul 26, 2019 · 12 comments

Comments

@FrelDX
Copy link

FrelDX commented Jul 26, 2019

一个pod多个容器,代码里面怎么指定总是进入到第一个容器中
image

@du2016
Copy link
Owner

du2016 commented Jul 26, 2019

可以先解析pod的container列表 ,然后获取第一个container name 就可以了

@FrelDX
Copy link
Author

FrelDX commented Jul 26, 2019

在代码的那个位置传入容器名字??不太会go

@FrelDX
Copy link
Author

FrelDX commented Jul 26, 2019

在浏览器传容器的名字好像不行呀 只能传pod名字。

@FrelDX
Copy link
Author

FrelDX commented Jul 26, 2019

image

@FrelDX
Copy link
Author

FrelDX commented Jul 26, 2019

但是如果一个pod有多个容器就会报错。现在我想能否直接给你的api转容器名字?

@FrelDX
Copy link
Author

FrelDX commented Jul 26, 2019

想改一下代码、如果发现有多少容器,直接登录到第一容器里。改terminalws.go这个文件哪里??

@du2016
Copy link
Owner

du2016 commented Jul 27, 2019

上面不是有containername参数 ,

Param("container", t.container).
现在是传参,只需要把这里的容器名称改为pod中第一个容器的名称

@FrelDX
Copy link
Author

FrelDX commented Jul 27, 2019

"container", t.container 那个参数???

@FrelDX
Copy link
Author

FrelDX commented Jul 27, 2019

我调用你的api的时候能直接给你穿pod容器的name吗??

@du2016
Copy link
Owner

du2016 commented Jul 27, 2019

image
现在通过url获取四个参数,container名称改为后端获取

@FrelDX
Copy link
Author

FrelDX commented Jul 27, 2019

嗯 但是我测试直接传2个参数也是能进容器的除了pod多容器情况

@FrelDX
Copy link
Author

FrelDX commented Jul 27, 2019

直接传podnmae和namespace就能进。如果想指定容器的话是不是我传3个参数就行了??把容器name传过去就行了??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants