• Stars
    star
    804
  • Rank 56,681 (Top 2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Run kubectl command in Web Browser.

中文 README.md

Web Kubectl - Run kubectl command in web browser

Downloads Go Report Card License Dockerized Version Visitors

webkubectl

Goal

Web Kubectl helps you manage kubernetes credentials and run kubectl command in web browser, so that you don't have to install kubectl on your local PC or some other servers, furthermore Web Kubectl can be used for a team.

Advantage

  • Support multiple user and multiple Kubernetes clusters:One deployment of Web Kubectl can be used for a team, all of the team members can use Web Kubectl simultaneously although they are connecting different Kubernetes clusters or different privileges.
  • Session isolation:All of the online sessions are isolated, each session has its own namespace and storage which is invisible to the others.
  • Support kubeconfig file and bearer token:You can provide kubeconfig file or bearer token to connect Kubernetes cluster through Web Kubectl.
  • Easy to use and integrate:You can simply use the index page for a quick start, or integrate with your application using api.
  • Manage Kubernetes clusters in VPC:Through Web Kubectl you can manage the Kubernetes clusters in VPC which is unreachable from you laptop.
_______________________________________________________________________
|   Local Network     |          DMZ           |      VPC/Datacenter  |
|                     |                        |                      |
|                     |    _______________     |   ----------------   |
|   ---------------   |    |             |  /~~~~~>| Kubernetes A |   |
|   | Your Laptop |~~~~~~~>| Web Kubectl | /   |   ----------------   |
|   ---------------   |    |             | \   |                      |
|                     |    ---------------  \  |   ----------------   |
|                     |                      \~~~~>| Kubernetes B |   |
|                     |                        |   ----------------   |
-----------------------------------------------------------------------

Architecture

Web Kubectl use webkubectl/gotty to run a JavaScript based terminal on web browsers.
When opens a new session, a temporary Linux namespace will be created for the session, this make sure all sessions are isolated, each session has its own namespace and storage, meanwhile .kube/config file is generated for current session.
When session terminated, the provisioned namespace and storage are deleted.

Installation

$ docker run --name="webkubectl" -p 8080:8080 -d --privileged kubeoperator/webkubectl

Advanced environment variables

ENV Type Default Value Description
SESSION_STORAGE_SIZE string 10M Storage size limit for single connection
KUBECTL_INSECURE_SKIP_TLS_VERIFY bool true Whether to skip tls verify
GOTTY_OPTIONS string --port 8080 --permit-write --permit-arguments Gotty options, see more
WELCOME_BANNER string Welcome to Web Kubectl, try kubectl --help. Welcome banner after web terminal opened

Usage

Use index page

Open below url in web browser.

http://<webkubectl-address>:<port>

In the opened page you can manage your own kubeconfig files or bearer tokens which are stored in local storage, then choose a session and click connect to use kubectl command in web terminal.

index

terminal

Use API

Get token by Kubernetes API server address and bearer token

$ curl http://<webkubectl-address>:<port>/api/kube-token -X POST -d '{"name":"gks-hk-dev","apiServer":"https://k8s-cluster:6443","token":"token-content"}'
#response
$ {"success":true,"token":"mkolj4hgbutfgy1thgp1","message":""}

Request Json

key Type Description
name string session name
apiServer string API server address
token string Kubernetes bearer token

Response Json

key Type Description
success bool the request is proceeded successfully or not
token string token used to open terminal
message string error message if success is false

Get token by kubeconfig file

$ curl http://<webkubectl-address>:<port>/api/kube-config -X POST -d '{"name":"k8s-cluster-bj1","kubeConfig":"<kubeconfig file content base64 encoded>"}'
#response
$ {"success":true,"token":"mkolj4hgbutfgy1thgp1","message":""}

Request Json

key Type Description
name string session name
kubeConfig string kubeconfig file content base64 encoded

Response Json

key Type Description
success bool the request is proceeded successfully or not
token string token used to open terminal
message string error message if success is false

Open web terminal with token fetched from API

http://<webkubectl-address>:<port>/terminal/?token=<token fetched from api>

Security

  • Token validation:The token fetched from api will be invalid immediately after it's used once, and it expires after 5 minutes if not used.
  • Authentication:By default all resources can be accessed without any authentication, to restrict anonymous access, you can enable the basic authentication of gotty, see how to.
  • SSL/TLS:By default all traffic between the server and clients are NOT encrypted, we recommend you enable SSL/TLS option of gotty, see how to. Alternatively you can deploy Web Kubectl behind a proxy and enable SSL/TLS for the proxy, please note that the proxy should support WebSocket protocol.

Extensions

Dependencies

License

Copyright (c) 2014-2023 FIT2CLOUD 飞致云

https://www.fit2cloud.com

Web Kubectl is licensed under the Apache License, Version 2.0.


Alternatives

Advertisement

KubeOperator

KubeOperator is an open source project, a web based application enable you to deploy and manage production ready Kubernetes clusters on VMware, Openstack, virtual machines and physical machines in LAN network without internet connectivity.
https://kubeoperator.io
https://github.com/kubeoperator/kubeoperator

More Repositories

1

KubeOperator

KubeOperator 是一个开源的轻量级 Kubernetes 发行版,专注于帮助企业规划、部署和运营生产级别的 K8s 集群。
Go
4,978
star
2

KubePi

KubePi 是一个现代化的 K8s 面板。
Go
1,212
star
3

kubeapps-plus

KubeApps 应用商店的定制版本,通过 Web UI 方式在 Kubernetes 集群中部署和管理基于 Helm Chart 的应用程序。
Go
142
star
4

k8s-package

KubeOpererator 2.0 离线安装包工程。
Shell
50
star
5

neeko

Neeko 是 KubeOperator 的新版前端 UI 项目
Vue
34
star
6

ansible

KubeOperator 3.0 Ansible Playbook,替代 2.0 版本中的 kubeasz 组件。
Jinja
28
star
7

kobe

KubeOperator 3.0 组件, REST API Wrapper and CLI-Client for Ansible
Go
16
star
8

docs

KubeOperator 文档。
JavaScript
15
star
9

K8SVersionManage

此项目主要用于针对KubeOperator自动构建K8S离线包,执行构建的主机需要能够访问互联网。构建完成后,将离线包传到KubeOperator部署机运行即可。
Shell
9
star
10

charts

KubeOperator 3.0 Helm Charts
Mustache
8
star
11

installer

KubeOperator 3.0 Installer
Shell
8
star
12

kotf

KubeOperator 3.0 组件,REST API Wrapper and CLI-Client for Terraform
Go
6
star
13

package

KubeOpererator 3.0 离线模式安装部署包。
Python
6
star
14

KubeGrade

K8s 集群健康评分
Python
3
star
15

terraform-provider-fusioncompute

Go
3
star
16

FusionComputeGolangSDK

Golang Client for FusionCompute 8.0
Go
3
star
17

KubeV

2
star
18

website

KubeOperator 官方网站
JavaScript
2
star
19

gpu-package

Shell
2
star
20

thirdparty

nginx mariadb 基础镜像
Shell
1
star
21

notification-utils

钉钉 企业微信 邮件 消息插件
Python
1
star