通过远程登录k8s集群中的pod的shell

后端:remote-go的remotecommand

前端:xterm

前端使用时,先申请一个新的websocket,然后类似如下

term.loadAddon(new AttachAddon(conn))

服务端需要把remotecommand封装成ws服务,符合webshell协议

可以参考k8s-web-terminal这个完整项目

也可以参考这篇文章 利用kubernetes exec接口实现任意容器的web-terminal 

还有这篇参考文章 Kubernetes Webshell

Leave a Reply

Your email address will not be published. Required fields are marked *