• Stars
    star
    228
  • Rank 175,267 (Top 4 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 4 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

The world's simplest Kubernetes dashboard (50 lines of Bash code)

k1s: The world's simplest Kubernetes dashboard

A minimalistic Kubernetes dashboard implemented with 50 lines of Bash code.

Screencast

Contents

  1. Introduction
  2. Installation
  3. Usage
  4. Examples

Introduction

What is it?

A minimalistic Kubernetes dashboard showing the current state of Kubernetes resources of a specific type in real-time. The entire tool consists merely of a Bash script with about 50 lines of code.

What is it not?

It's not a production-grade dashboard with many features. It's mainly intended for educational purposes.

How does it work?

With a lot of highly condensed Bash scripting. This article explains how it works in detail.

Installation

On macOS

brew install weibeld/tap/k1s

On other systems

Simply download the k1s script, make it executable, and move it to any directory in your PATH.

For example:

wget https://raw.githubusercontent.com/weibeld/k1s/master/k1s
chmod +x k1s
mv k1s /usr/local/bin

Dependencies

The k1s script depends on the following tools:

jq

OS Installation
macOS brew install jq
Linux sudo apt-get install jq

watch

OS Installation
macOS brew install watch
Linux — (installed by default)

curl

OS Installation
macOS — (installed by default)
Linux sudo apt-get install curl

kubectl

OS Installation
macOS brew install kubernetes-cli
Linux See https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/

Usage

k1s runs directly on your local machine and it uses the usual kubeconfig configuration on your machine. That means, it connects to the same cluster that also kubectl connects to by default.

The command-line interface is as follows:

k1s [<namespace>] [<resource-type>]

Both arguments are optional. The default values are:

Argument Default value
<namespace> default
<resource-type> pods

The <namespace> argument may be set to any valid namespace in the cluster. In addition, <namespace> may be set to - to imply "all namespaces" for namespaced resource types and "no namespace" for non-namespaced resource types (e.g. ClusterRoles).

You can find out which resource types are namespaced or non-namespaced with kubectl api-resources --namespaced=true|false.

The <resource-type> argument may be set to any valid resource type name (including their singular, plural and short forms).

You can list all supported resource type names with kubectl api-resources.

To exit the dashboard, type Ctrl-C.

Examples

Below is an example usage scenario for k1s. It uses multiple instances of k1s for observing what's going on under the hood when scaling a Deployment:

Example application

Note how during the rolling update, you can observe how the replica count of the Deployment always stays within a certain range. You can influence this range with the maxSurge and maxUnavailable settings in the Deployment specification.

To recreate the above example, launch three instances of k1s in separate terminal windows (or in different tmux panes, as shown above):

k1s default deployments
k1s default replicasets
k1s default pods

Then, create a Deployment:

kubectl create deployment dep1 --image=nginx

Scale the Deployment:

kubectl scale deployment dep1 --replicas=10

Patch the Deployment with a new container image, which causes a rolling update:

kubectl patch deployment dep1 -p '{"spec":{"template":{"spec":{"containers":[{"name":"nginx","image":"nginx:1.19.0"}]}}}}'

You can also manually edit the Deployment with kubectl edit deployment dep1.

Finally, delete the Deployment:

kubectl delete deployment dep1

Advanced usage scenarios

Here's a list of more advanced usage scenarios contributed by users of k1s:

If you want to have your work added, file an issue, or directly make a pull request with your link added to this list.

More Repositories

1

heroku-buildpack-run

Run custom commands during the build of a Heroku app
Shell
70
star
2

kubernetes-client-go-examples

Example usages of the Kubernetes Go client library (client-go)
Go
40
star
3

terraform-aws-kubeadm

Terraform module for creating a Kubernetes cluster with kubeadm on AWS
HCL
35
star
4

kubectl-ctx

A kubectl plugin for interactively changing the kubeconfig context
Shell
28
star
5

kubectl-ns

A kubectl plugin for interactively switching between namespaces in your cluster
Shell
22
star
6

AndroidTabsExample

An Example Android Application with Tabs
Java
18
star
7

heroku-buildpack-graphviz

Install Graphviz on Heroku
Shell
18
star
8

sam-hello-world

AWS Serverless Application Model (SAM) Hello World Application
JavaScript
17
star
9

Understanding-LTE-With-Matlab

LTE physical layer implementation with the Matlab Communication System Toolbox
MATLAB
17
star
10

eks-cloudformation

Create an Amazon EKS cluster with CloudFormation in a single command
Shell
11
star
11

k8s-ldap-authentication

Webhook service for Kubernetes LDAP authentication with the Webhook Token authentication plugin
Go
10
star
12

dotfiles

Dotfiles, instructions on https://gist.github.com/weibeld/869f723063811e5088708a9386bf52bf
Vim Script
6
star
13

lambda-eks-example

Accessing an Amazon EKS cluster from an AWS Lambda function with Go
Go
6
star
14

cni-plugin-comparison

Comparison of the most popular CNI plugins on Kubernetes
5
star
15

AndroidDialogFragmentExample

Example usage of DialogFragment in Android
Java
5
star
16

webdesign-expanding-search-bar

Example implementation of an expanding/collapsing search bar
JavaScript
4
star
17

docker-ubuntu-networking

Ubuntu 18.04 LTS Docker image with common networking tools installed
Dockerfile
4
star
18

OLD-weibeld-notes

Website with computer science and programming notes
SCSS
4
star
19

beer-labels

Bottle labels for home-brewed beer drawn with OmniGraffle
3
star
20

aws-icons-svg

Official AWS architecture icons in SVG format
Shell
3
star
21

AndroidDeals

Android app for creating and redeeming deals
Java
2
star
22

csv-toolset

A toolset for analysing and manipulating CSV files written in Bash and R
Shell
2
star
23

k8s-conncheck

Kubernetes network connectivity checker
Shell
2
star
24

github-actions-examples

GitHub Actions example workflows
2
star
25

terminal-escape-sequences

Examples of using ANSI terminal escape sequences in Bash scripts
Shell
2
star
26

Algorithms

Code from the book "Algorithms, 4th Edition" by Robert Sedgewick
Java
2
star
27

ansible-kubernetes

Ansible playbooks for installing multiple Kubernetes clusters with kubeadm
1
star
28

invoicebot

A Slack bot that creates and sends invoices automatically
Go
1
star
29

artboard-multi-scale

A Sketch plugin for scaling an Artboard to multiple dimensions at once
JavaScript
1
star
30

cloud-native-books

A collection of books from the cloud-native world
1
star
31

cobra-autocompletion

Some investigations into Cobra auto-completion
Shell
1
star
32

cloud-infra-cli

Creating an example cloud infrastructure on the major cloud providers with the official CLI clients
Shell
1
star
33

Java-8-CompletableFuture-Demo

Sample Java 8 application demonstrating CompletableFuture
Java
1
star
34

nfs-subdir-external-provisioner-exporter

Prometheus exporter for the nfs-subdir-external-provisioner
Shell
1
star
35

groundlayer

GroundLayer website
PHP
1
star
36

cloud-native-logos

Collection of various logos in SVG format from the cloud-native and infrastructure worlds
1
star
37

AndroidAccRSSLog

Android app for logging accelerometer data and received signal strength simultaneously
Java
1
star
38

kubernetes-the-hard-way-files

Doing Kubernetes The Hard Way
Shell
1
star
39

docker-ubuntu-kubectl

Docker image: Ubuntu 18.04 with kubectl installed
Dockerfile
1
star