A top-like tool for your Kubernetes clusters

Related tags

DevOps Tools ktop
Overview

ktop

ktop

A top-like tool for your Kubernetes cluster.

Following the tradition of Unix/Linux top tools, ktop is a tool that displays useful metrics information about nodes, pods, and other workload resources running in a Kubernetes cluster.

Features

  • Insightful summary of cluster resource metrics
  • Ability to work with or without a metrics-server deployed
  • Displays nodes and pods usage metrics when a Metrics Server is found
  • Uses your existing cluster configuration to connect to a cluster's API server

Installing ktop

kubectl ktop plugin

Project ktop is distributed as a kubectl plugin. To use ktop as a plugin do the followings:

  • Install krew plugin manager (if not present)
  • Ensure ktop is available to be installed: kubectl krew search ktop
  • Next, install the plugin: kubectl krew install ktop

Once installed, start the ktop plugin with

kubectl ktop

Download binary

Another easy way to get started with ktop is to download the pre-built binary (for your system):

https://github.com/vladimirvivien/ktop/releases/latest

Then, extract the ktop binary and copy it to your system's execution path.

Using go install

If you have a recent version of Go installed (1.14 or later) you can build and install ktop as follows:

go install github.com/vladimirvivien/[email protected]

This should place the ktop binary in your configured $GOBIN path or place it in its default location, $HOME/go/bin.

Build from source

Download or clone the source (from GitHub). From the project's root directory, do the following:

go build .

The project also comes with a Go program that you can use for cross-platform builds.

go run ./ci/build.go

Running ktop

With a locally accessible kubeconfig file on your machine, ktop can be executed simply:

ktop

The previous command will use either environment variable $KUBECONFIG or the default path for the kubeconfig file. The program currently accepts the following arguments:

Usage:
  ktop [flags]

Flags:
  -A, --all-namespaces                 If true, display metrics for all accessible namespaces
      --as string                      Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
      --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --as-uid string                  UID to impersonate for the operation.
      --cache-dir string               Default cache directory (default "/Users/vivienv/.kube/cache")
      --certificate-authority string   Path to a cert file for the certificate authority
      --client-certificate string      Path to a client certificate file for TLS
      --client-key string              Path to a client key file for TLS
      --cluster string                 The name of the kubeconfig cluster to use
      --context string                 The name of the kubeconfig context to use
  -h, --help                           help for ktop
      --insecure-skip-tls-verify       If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --kubeconfig string              Path to the kubeconfig file to use for CLI requests.
  -n, --namespace string               If present, the namespace scope for this CLI request
      --request-timeout string         The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
  -s, --server string                  The address and port of the Kubernetes API server
      --tls-server-name string         Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
      --token string                   Bearer token for authentication to the API server
      --user string                    The name of the kubeconfig user to use```

For instance, the following will show cluster information for workload resources associated with namespace my-app in context web-cluster using the default kubconfig file path:

ktop --namespace my-app --context web-cluster

ktop metrics

The ktop UI provides several metrics including a high-level summary of workload components installed on your cluster:

ktop

Usage metrics from metrics-server

ktop can display metrics with or without Metrics Server present. When a cluster has an instance of a kubernetes-sigs/metrics-server installed (and properly configured), ktop will automatically discover the server as shown:

ktop

With the metrics server installed, ktop will display resource utilization metrics as reported by the Metrics Server.

Request/limit metrics

When there is no Metrics Server present in the cluster, ktop will still work:

ktop

Instead of resource utilization, ktop will display resource requests and limits for nodes and pods.

Roadmap

  • A multi-page UI to display metrics for additional components
  • Display OOM processes
  • Additional installation methods (Homebrew, linux packages, etc)
  • Etc
Issues
  • Error when building on Linux: 'utf-8' codec can't decode byte 0xc2 in position 6583: invalid continuation byte

    Error when building on Linux: 'utf-8' codec can't decode byte 0xc2 in position 6583: invalid continuation byte

    Hi,

    when building this package as an RPM on openSUSE, I get the following error:

    [  183s] ktop.x86_64: E: readelf-failed /usr/bin/ktop 'utf-8' codec can't decode byte 0xc2 in position 6583: invalid continuation byte
    [  183s] Executing readelf on this file failed, all checks could not be run.
    
    

    Any idea how to fix that? Is this something that needs to be done inside the source code or am I missing some flags for the build command? (Sorry, golang-Newbie here...)

    opened by johanneskastl 7
  • add support for clusters with oidc auth

    add support for clusters with oidc auth

    null

    opened by dkulchinsky 1
  • chore: Rename Nmspaces to Namespaces

    chore: Rename Nmspaces to Namespaces

    Hi,

    not sure if it's intentional or a spelling error: image

    But this PR renames it to image

    BTW: love ktop!

    opened by dirien 1
  • Not able to start k8s client controller

    Not able to start k8s client controller

    Any pointers as to why this could happen? I tried connecting to two different clusters: v1.20.2 (kind cluster), v1.18.20-gke.3000

    >> kubectl-ktop --context REDACTED --namespace REDACTED
     _    _
    | | _| |_ ___  _ __
    | |/ / __/ _ \| '_ \
    |   <| || (_) | |_) |
    |_|\_\\__\___/| .__/
                  |_|
    Version v0.2.0 (426916f7d1eb3d9da0586970b112f21d6ebdfff0)
    W0113 18:54:57.725344   94762 reflector.go:324] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: failed to list *unstructured.Unstructured: the server could not find the requested resource
    E0113 18:54:57.725619   94762 reflector.go:138] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: Failed to watch *unstructured.Unstructured: failed to list *unstructured.Unstructured: the server could not find the requested resource
    W0113 18:54:58.869531   94762 reflector.go:324] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: failed to list *unstructured.Unstructured: the server could not find the requested resource
    E0113 18:54:58.869558   94762 reflector.go:138] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: Failed to watch *unstructured.Unstructured: failed to list *unstructured.Unstructured: the server could not find the requested resource
    W0113 18:55:01.774346   94762 reflector.go:324] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: failed to list *unstructured.Unstructured: the server could not find the requested resource
    E0113 18:55:01.774377   94762 reflector.go:138] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: Failed to watch *unstructured.Unstructured: failed to list *unstructured.Unstructured: the server could not find the requested resource
    
    opened by ashwanthgoli 1
  • Moving to controller runtime

    Moving to controller runtime

    This PR is to replace the existing client based on untyped clients to controller runtime since will focus on known types.

    opened by vladimirvivien 0
  • Support for kubectl/krew plugin

    Support for kubectl/krew plugin

    Support for ktop to run as a kubectl plugin and be managed in krew. Once complete, users will be able to launch the program in either of the following ways:

    ktop 
    

    Or,

    kubectl ktop
    
    opened by vladimirvivien 0
  • could not find the requested resource

    could not find the requested resource

    It's a bit hard to distinguish which resource ktop can't find that trying to access for.

    Version v0.2.0 (426916f7d1eb3d9da0586970b112f21d6ebdfff0)
    W0110 09:21:44.436882    4254 reflector.go:324] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: failed to list *unstructured.Unstructured: the server could not find the requested resource
    

    Maybe adding some verbosity here would be nice.

    opened by Dentrax 3
  • Program shows long log output when server not available

    Program shows long log output when server not available

    When the API server is not available, ktop simply output a log message instead of immediately disconnecting

    kubectl ktop
    Connected to: http://localhost:8080
    ...
    W0108 13:32:42.673131   55437 reflector.go:324] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: failed to list *unstructured.Unstructured: Get "http://localhost:8080/apis/apps/v1/replicasets?limit=500&resourceVersion=0": dial tcp [::1]:8080: connect: connection refused
    W0108 13:32:42.673162   55437 reflector.go:324] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: failed to list *unstructured.Unstructured: Get "http://localhost:8080/apis/batch/v1/jobs?limit=500&resourceVersion=0": dial tcp [::1]:8080: connect: connection refused
    E0108 13:32:42.673484   55437 reflector.go:138] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: Failed to watch *unstructured.Unstructured: failed to list *unstructured.Unstructured: Get "http://localhost:8080/apis/apps/v1/replicasets?limit=500&resourceVersion=0": dial tcp [::1]:8080: connect: connection refused
    ...
    

    A better approach would be to stop sooner if the api server is not immediately available. Or, manage the UI better as a valid connection is being tried.

    opened by vladimirvivien 1
  • Workload panel is empty

    Workload panel is empty

    In overview screen the workload panel does not show anything.

    opened by vladimirvivien 0
  • Overview screen not updating

    Overview screen not updating

    Panels on the overview screens not updating properly.

    1. Since resource pod (, node, etc) events are triggered by controllers, it seems the metrics dot update if ctrlr not firing
    2. When resources are removed, the panels are not updating their lists properly
    bug 
    opened by vladimirvivien 0
  • Create working dir to capture logs and other artifacts

    Create working dir to capture logs and other artifacts

    When ktop starts, it should create/setup a $HOME/.ktop dir on srart (if not found). That location should be used to store runtime logs and other artifacts (plugins, etc).

    enhancement 
    opened by vladimirvivien 0
  • Namespace is not applied properly

    Namespace is not applied properly

    When GUI is refreshed, resources from all ns are pulled even when namespace is set.

    bug 
    opened by vladimirvivien 0
Releases(v0.2.0)
Owner
Vladimir Vivien
Software Engineer, VMware
Vladimir Vivien
vcluster - Create fully functional virtual Kubernetes clusters - Each cluster runs inside a Kubernetes namespace and can be started within seconds

Website • Quickstart • Documentation • Blog • Twitter • Slack vcluster - Virtual Clusters For Kubernetes Lightweight & Low-Overhead - Based on k3s, bu

Loft Labs 1.2k Jan 15, 2022
Kubernetes IN Docker - local clusters for testing Kubernetes

kind is a tool for running local Kubernetes clusters using Docker container "nodes".

Kubernetes SIGs 9.1k Jan 16, 2022
provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters

provider-kubernetes provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters ty

International Business Machines 2 Jan 5, 2022
Crossplane provider to provision and manage Kubernetes objects on (remote) Kubernetes clusters.

provider-kubernetes provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters ty

Crossplane Contrib 30 Dec 30, 2021
🐶 Kubernetes CLI To Manage Your Clusters In Style!

K9s - Kubernetes CLI To Manage Your Clusters In Style! K9s provides a terminal UI to interact with your Kubernetes clusters. The aim of this project i

Fernand Galiana 15k Jan 19, 2022
Validation of best practices in your Kubernetes clusters

Best Practices for Kubernetes Workload Configuration Fairwinds' Polaris keeps your clusters sailing smoothly. It runs a variety of checks to ensure th

Fairwinds 2.4k Jan 19, 2022
Client extension for interacting with Kubernetes clusters from your k6 tests.

⚠️ This is a proof of concept As this is a proof of concept, it won't be supported by the k6 team. It may also break in the future as xk6 evolves. USE

k6 4 Jan 15, 2022
Managing your Kubernetes clusters (including public, private, edge, etc) as easily as visiting the Internet

Clusternet Managing Your Clusters (including public, private, hybrid, edge, etc) as easily as Visiting the Internet. Clusternet (Cluster Internet) is

Clusternet 967 Jan 21, 2022
A pain of glass between you and your Kubernetes clusters.

kube-lock A pain of glass between you and your Kubernetes clusters. Sits as a middle-man between you and kubectl, allowing you to lock and unlock cont

Tom Meadows 4 Nov 16, 2021
Hot-swap Kubernetes clusters while keeping your microservices up and running.

Okra Okra is a Kubernetes controller and a set of CRDs which provide advanced multi-cluster appilcation rollout capabilities, such as canary deploymen

Yusuke Kuoka 32 Jan 6, 2022
Kubernetes OS Server - Kubernetes Extension API server exposing OS configuration like sysctl via Kubernetes API

KOSS is a Extension API Server which exposes OS properties and functionality using Kubernetes API, so it can be accessed using e.g. kubectl. At the moment this is highly experimental and only managing sysctl is supported. To make things actually usable, you must run KOSS binary as root on the machine you will be managing.

Mateusz Gozdek 3 May 19, 2021
Flux is a tool for keeping Kubernetes clusters in sync with sources of configuration, and automating updates to configuration when there is new code to deploy.

Flux is a tool for keeping Kubernetes clusters in sync with sources of configuration (like Git repositories), and automating updates to configuration when there is new code to deploy.

Flux project 2.6k Jan 15, 2022
kubequery is a Osquery extension that provides SQL based analytics for Kubernetes clusters

kubequery powered by Osquery kubequery is a Osquery extension that provides SQL based analytics for Kubernetes clusters kubequery will be packaged as

Uptycs Inc 60 Dec 22, 2021
Manage large fleets of Kubernetes clusters

Introduction Fleet is GitOps at scale. Fleet is designed to manage up to a million clusters. It's also lightweight enough that it works great for a si

Rancher 1k Jan 23, 2022
A best practices checker for Kubernetes clusters. 🤠

Clusterlint As clusters scale and become increasingly difficult to maintain, clusterlint helps operators conform to Kubernetes best practices around r

DigitalOcean 437 Jan 20, 2022
Kubernetes operator to autoscale Google's Cloud Bigtable clusters

Bigtable Autoscaler Operator Bigtable Autoscaler Operator is a Kubernetes Operator to autoscale the number of nodes of a Google Cloud Bigtable instanc

RD Station 22 Nov 5, 2021
Nebula Operator manages NebulaGraph clusters on Kubernetes and automates tasks related to operating a NebulaGraph cluster

Nebula Operator manages NebulaGraph clusters on Kubernetes and automates tasks related to operating a NebulaGraph cluster. It evolved from NebulaGraph Cloud Service, makes NebulaGraph a truly cloud-native database.

vesoft inc. 39 Dec 28, 2021
kcount counts Kubernetes (K8s) objects across clusters.

kcount counts Kubernetes (K8s) objects across clusters. It gets the cluster configuration, including cluster name and namespace, from kubeconfig files

Deutsche Telekom Pan-Net 1 Nov 2, 2021
Terraform module to provisison Kubernetes Clusters on Hetzner cloud (Based on KubeOne)

Terraform module template Terraform module which creates describe your intent resources on AWS. Usage Use this template to scaffold a new terraform mo

Synesium 0 Nov 26, 2021