# Kubebox | Terminal And Web Console For Kubernetes

**URL:** <https://onehack.st/t/kubebox-terminal-and-web-console-for-kubernetes/98886>\
**Category:** Tools & Scripts\
**Tags:** tools, programming\
**Created:** [July 31, 2020, 10:54am UTC](https://onehack.st/t/kubebox-terminal-and-web-console-for-kubernetes/98886 "2020-07-31T10:54:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prometheus](https://onehack.st/user_avatar/onehack.st/prometheus/32/34950_2.png) [@Prometheus](https://onehack.st/u/Prometheus)\
**Post date:** [July 31, 2020, 10:54am UTC](https://onehack.st/t/kubebox-terminal-and-web-console-for-kubernetes/98886/1 "2020-07-31T10:54:43Z")

</div>

# Kubebox ⎈❏

Terminal and Web console for Kubernetes

[![](https://camo.githubusercontent.com/e7c223dcc38bf09b3c1849ab270461b3a3012cfc/68747470733a2f2f6173746566616e757474692e6769746875622e696f2f6b756265626f782f6b756265626f782e706e67)](https://astefanutti.github.io/kubebox/kubebox.png)

### Features

- ✓ Configuration from _kubeconfig_ files ( `KUBECONFIG` environment variable or `$HOME/.kube` )
- ✓ Switch contexts interactively
- ✓ [Authentication support](https://github.com/astefanutti/kubebox#authentication) (bearer token, basic auth, private key / cert, OAuth, OpenID Connect, Amazon EKS, Google Kubernetes Engine, Digital Ocean)
- ✓ Namespace selection and pods list watching
- ✓ Container log scrolling / watching
- ✓ Container resources usage (memory, CPU, network, file system charts) [[1](https://github.com/astefanutti/kubebox#_footnotedef_1)]
- ✓ Container remote exec terminal
- ✓ Cluster, namespace, pod events
- ❏ Object configuration editor and CRUD operations
- ❏ Cluster and nodes views / monitoring

See the [Screenshots](https://github.com/astefanutti/kubebox#screenshots) section for some examples, and follow [![%40kubebox 00ACEE](https://camo.githubusercontent.com/50421feb12b154e2692255db7bd2638946618d2e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2534306b756265626f782d3030414345452e7376673f266c6f676f3d7477697474657226636f6c6f72413d353535266c6f676f436f6c6f723d666666)](https://twitter.com/kubebox) for some updates.

## Run

The following alternatives are available for you to use Kubebox, depending on your preferences and constraints:

### Executable

Download the Kubebox standalone executable for your OS:

# Linux $ curl -Lo kubebox [https://github.com/astefanutti/kubebox/releases/download/v0.8.0/kubebox-linux](https://github.com/astefanutti/kubebox/releases/download/v0.8.0/kubebox-linux) && chmod +x kubebox # OSX $ curl -Lo kubebox [https://github.com/astefanutti/kubebox/releases/download/v0.8.0/kubebox-macos](https://github.com/astefanutti/kubebox/releases/download/v0.8.0/kubebox-macos) && chmod +x kubebox # Windows $ curl -Lo kubebox.exe [https://github.com/astefanutti/kubebox/releases/download/v0.8.0/kubebox-windows.exe](https://github.com/astefanutti/kubebox/releases/download/v0.8.0/kubebox-windows.exe)

Then run:

$ ./kubebox

### Server

Kubebox can be served from a service hosted in your Kubernetes cluster. Terminal emulation is provided by [Xterm.js](https://github.com/xtermjs/xterm.js) and the communication with the Kubernetes master API is proxied by the server.

To deploy the server in your Kubernetes cluster, run:

$ kubectl apply -f [https://raw.github.com/astefanutti/kubebox/master/kubernetes.yaml](https://raw.github.com/astefanutti/kubebox/master/kubernetes.yaml)

To shut down the server and clean-up resources, run:

$ kubectl delete namespace kubebox

For the Ingress resource to work, the cluster must have an Ingress controller running. See [Ingress controllers](https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-controllers) for more information.

Alternatively, to deploy the server in your OpenShift cluster, run:

$ oc new-app -f [https://raw.github.com/astefanutti/kubebox/master/openshift.yaml](https://raw.github.com/astefanutti/kubebox/master/openshift.yaml)

### Kubectl

You can run Kubebox as an _in-cluster_ client with `kubectl` , e.g.:

$ kubectl run kubebox -it --rm --env=“TERM=xterm” --image=astefanutti/kubebox --restart=Never

If RBAC is enabled, you’ll have to use the `--serviceaccount` option and reference a service account with sufficient permissions.

### Docker

You can run Kubebox using Docker, e.g.:

$ docker run -it --rm astefanutti/kubebox

You may want to mount your home directory so that Kubebox can rely on the `~/.kube/config` file, e.g.:

$ docker run -it --rm -v ~/.kube/:/home/node/.kube/:ro astefanutti/kubebox

### Online

Kubebox is available online at [https://astefanutti.github.com/kubebox](https://astefanutti.github.com/kubebox). Note that it requires this address to match the allowed origins for CORS by the API server. This can be achived with the [Kubernetes API server CLI](https://kubernetes.io/docs/admin/kube-apiserver/), e.g.:

$ kube-apiserver --cors-allowed-origins .\*

## Authentication

We try to support the various authentication strategies supported by `kubectl` , in order to provide seamless integration with your local setup. Here are the different authentication strategies we support, depending on how you’re using Kubebox:

| | Executable | Docker | Online |
| --- | --- | --- | --- |
| OpenID Connect | ✔ | ✔ | ✔[[2](https://github.com/astefanutti/kubebox#_footnotedef_2)] |
| Amazon EKS | ✔ | | |
| Digital Ocean | ✔ | | |
| Google Kubernetes Engine | ✔ | | |

If the mode you’re using isn’t supported, you can refresh the authentication token/certs manually and update your _kubeconfig_ file accordingly.

## cAdvisor

Kubebox relies on [cAdvisor](https://github.com/google/cadvisor) to retrieve the resource usage metrics. Before version 0.8.0, Kubebox used to access the cAdvisor endpoints, that are embedded in the _Kubelet_ . However, these endpoints are being deprecated, and will eventually be removed, as discussed in [kubernetes#68522](https://github.com/kubernetes/kubernetes/issues/68522).

Starting version 0.8.0, Kubebox expects cAdvisor to be deployed as a [DaemonSet](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/). This can be achieved with:

$ kubectl apply -f [https://raw.github.com/astefanutti/kubebox/master/cadvisor.yaml](https://raw.github.com/astefanutti/kubebox/master/cadvisor.yaml)

It’s recommended to use the provided `cadvisor.yaml` file, that’s tested to work with Kubebox. However, the DaemonSet example, from the [cAdvisor](https://github.com/google/cadvisor) project, should also work just fine. Note that the cAdvisor containers must run with a _privileged_ security context, so that they can access the container runtime on each node.

You can change the default `--storage_duration` and `--housekeeping_interval` options, added to the cAdvisor container arguments declared in the `cadvisor.yaml` file, to adjust the duration of the storage moving window (default to `5m0s` ), and the sampling period (default to `10s` ) respectively. You may also have to provide the path of your cluster container runtime socket, in case it’s not following the usual convention.

## Hotkeys

| Keybinding | Description |
| --- | --- |
| _General_ | |
| l, Ctrl+l | Login |
| n | Change current namespace |
| [Shift+]←, → | |
| [Alt+]1, …​, 9 | Navigate screens |
| (use Shift or Alt inside exec terminal) | |
| ↑, ↓ | Navigate list / form / log |
| Enter | Select item / submit form |
| Esc | Close modal window / cancel form / rewind focus |
| Ctrl+z | Close current tab |
| q, Ctrl+q | Exit [[3](https://github.com/astefanutti/kubebox#_footnotedef_3)] |
| _Login_ | |
| ←, → | Navigate Kube configurations |
| _Pods_ | |
| Enter | Select pod / cycle containers |
| r | Remote shell into container |
| m | Memory usage |
| c | CPU usage |
| t | Network usage |
| f | File system usage |
| e | Open pod events tab |
| Shift+e | Open namespace events tab |
| Ctrl+e | Open cluster events tab |
| _Log_ | |
| g, Shift+g | Move to top / bottom |
| Ctrl+u, Ctrl+d | Move one page up / down |

## FAQ

- _ **Resources usage metrics are unavailable!** _

# Permission to list the cAdvisor pods (selected using the `spec.nodeName` field selector) $ kubectl auth can-i list pods -n cadvisor yes # Permission to proxy the selected cAdvisor pod, to call its REST API $ kubectl auth can-i get pod --subresource proxy -n cadvisor yes

## Development

$ git clone [https://github.com/astefanutti/kubebox.git](https://github.com/astefanutti/kubebox.git) $ cd kubebox $ npm install $ node index.js

## Screenshots

Cluster events:

[![](https://camo.githubusercontent.com/76a5d4b1410bb133e304bef8752eb8a800418fe8/68747470733a2f2f6173746566616e757474692e6769746875622e696f2f6b756265626f782f6576656e74732e706e67)](https://astefanutti.github.io/kubebox/events.png)

Shell into a container:

[![](https://camo.githubusercontent.com/29f35a50a3d23eb7bbc7f2dcec98c2b50223c74b/68747470733a2f2f6173746566616e757474692e6769746875622e696f2f6b756265626f782f657865632e706e67)](https://astefanutti.github.io/kubebox/exec.png)

Terminal theme support:

[![](https://camo.githubusercontent.com/2f3d7aeb1033b33918841b72d5bfd42229925286/68747470733a2f2f6173746566616e757474692e6769746875622e696f2f6b756265626f782f7468656d652e706e67)](https://astefanutti.github.io/kubebox/theme.png)

Web browser version:

[![](https://camo.githubusercontent.com/14cca4c055d86f56030b577eef5b26a985b9663a/68747470733a2f2f6173746566616e757474692e6769746875622e696f2f6b756265626f782f7765622e706e67)](https://astefanutti.github.io/kubebox/web.png)

[1](https://github.com/astefanutti/kubebox#_footnoteref_1). Requires [cAdvisor](https://github.com/google/cadvisor) to be deployed as a DaemonSet. See the [cAdvisor](https://github.com/astefanutti/kubebox#cadvisor) section for more details.

[2](https://github.com/astefanutti/kubebox#_footnoteref_2). Custom IDP certificate authority files are not supported in Web versions.

[3](https://github.com/astefanutti/kubebox#_footnoteref_3). Not available in Web versions.

## GitHub:

[https://github.com/astefanutti/kubebox](https://github.com/astefanutti/kubebox)

---

<div class="post-metadata">

**Author:** ![Mohit\_Wasnik](https://onehack.st/user_avatar/onehack.st/mohit_wasnik/32/22070_2.png) [@Mohit\_Wasnik](https://onehack.st/u/Mohit_Wasnik)\
**Post date:** [July 31, 2020, 5:39pm UTC](https://onehack.st/t/kubebox-terminal-and-web-console-for-kubernetes/98886/2 "2020-07-31T17:39:48Z")

</div>

WOW thanks dude!!

That will be super helpful.  
Bookmarked!
