An interactive kubernetes client featuring auto-complete.

kube-prompt

Software License Go Report Card

An interactive kubernetes client featuring auto-complete using go-prompt.

demo

kube-prompt accepts the same commands as the kubectl, except you don't need to provide the kubectl prefix. So it doesn't require the additional cost to use this cli.

And you can integrate other commands via pipe (|).

>>> get pod | grep web
web-1144924021-2spbr        1/1     Running     4       25d
web-1144924021-5r1fg        1/1     Running     4       25d
web-1144924021-pqmfq        1/1     Running     4       25d

Installation

Downloading standalone binary

Binaries are available from github release.

macOS (darwin) - amd64
wget https://github.com/c-bata/kube-prompt/releases/download/v1.0.11/kube-prompt_v1.0.11_darwin_amd64.zip
unzip kube-prompt_v1.0.11_darwin_amd64.zip
chmod +x kube-prompt
sudo mv ./kube-prompt /usr/local/bin/kube-prompt
Linux - amd64
wget https://github.com/c-bata/kube-prompt/releases/download/v1.0.11/kube-prompt_v1.0.11_linux_amd64.zip
unzip kube-prompt_v1.0.11_linux_amd64.zip
chmod +x kube-prompt
sudo mv ./kube-prompt /usr/local/bin/kube-prompt
Linux - i386
wget https://github.com/c-bata/kube-prompt/releases/download/v1.0.11/kube-prompt_v1.0.11_linux_386.zip
unzip kube-prompt_v1.0.11_linux_386.zip
chmod +x kube-prompt
sudo mv ./kube-prompt /usr/local/bin/kube-prompt
Linux - arm64
wget https://github.com/c-bata/kube-prompt/releases/download/v1.0.11/kube-prompt_v1.0.11_linux_arm64.zip
unzip kube-prompt_v1.0.11_linux_arm64.zip
chmod +x kube-prompt
sudo mv ./kube-prompt /usr/local/bin/kube-prompt

Using Homebrew (macOS)

$ brew install c-bata/kube-prompt/kube-prompt

Arch Linux

An unofficial AUR package kube-prompt is available. Install instructions can be found on the Arch wiki.

Building from source

$ GO111MODULE=on go build .

To create a multi-platform binary, use the cross command via make:

$ make cross

Similar projects

Goal

Hopefully support following commands enough to operate kubernetes.

  • get Display one or many resources
  • describe Show details of a specific resource or group of resources
  • create Create a resource by filename or stdin
  • replace Replace a resource by filename or stdin.
  • patch Update field(s) of a resource using strategic merge patch.
  • delete Delete resources by filenames, stdin, resources and names, or by resources and label selector.
  • edit Edit a resource on the server
  • apply Apply a configuration to a resource by filename or stdin
  • namespace SUPERSEDED: Set and view the current Kubernetes namespace
  • logs Print the logs for a container in a pod.
  • rolling-update Perform a rolling update of the given ReplicationController.
  • scale Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.
  • cordon Mark node as unschedulable
  • drain Drain node in preparation for maintenance
  • uncordon Mark node as schedulable
  • attach Attach to a running container.
  • exec Execute a command in a container.
  • port-forward Forward one or more local ports to a pod.
  • proxy Run a proxy to the Kubernetes API server
  • run Run a particular image on the cluster.
  • expose Take a replication controller, service, or pod and expose it as a new Kubernetes Service
  • autoscale Auto-scale a Deployment, ReplicaSet, or ReplicationController
  • rollout rollout manages a deployment
  • label Update the labels on a resource
  • annotate Update the annotations on a resource
  • config config modifies kubeconfig files
  • cluster-info Display cluster info
  • api-versions Print the supported API versions on the server, in the form of "group/version".
  • version Print the client and server version information.
  • explain Documentation of resources.
  • convert Convert config files between different API versions
  • top Display Resource (CPU/Memory/Storage) usage

Author

Masashi Shibata

LICENSE

This software is licensed under the MIT License (See LICENSE).

Owner
Masashi Shibata
Creator of go-prompt and kube-prompt. Optuna committer. Kubeflow/Katib reviewer.
Masashi Shibata
Comments
  • resources are not prompted

    resources are not prompted

    First of all, thanks for the project, this tool is awesome. I'm using it but from the gifs you provided I understand that it also supports prompting names of actual resources that are available in my cluster. For example if I write "get pods a" it should prompt me all pods that start with "a". Unfortunately it doesn't work for me and I have no idea how to troubleshoot that. Any ideas?

  • Register at a homebrew official repository

    Register at a homebrew official repository

    kube-prompt is gradually becoming a little bit famous. So perhaps it is the worth to register at a homebrew official repository. It is a little bit comfortable because we don't need brew tap.

  • Setting default namespace

    Setting default namespace

    I think this feature would be very useful when we're working in certain namespace. For example, we would execute kube-prompt --namespace staging to set default namespace to staging if not set explicitly in the prompt. So we don't need to type --namespace option for each commands.

    Bonus: Taking more generic approach, it would be better if kube-prompt CLI accept options from original kubectl command as defaults. For example, executing kube-prompt --namespace dev -o wide sets default namespace to dev and output format to wide for any compatible commands. (i.e. it behaves like currying/partial application in functional programming)

  • Upgrade dependencies: go-client v8.0.0, k8s v1.11

    Upgrade dependencies: go-client v8.0.0, k8s v1.11

    This is not well tested, but I did the annoying work to upgrade the kubernetes go-client dependency to version 8.0.0 and adjust to the breaking changes that comes with it (mostly breaking changes that were introduced by version 5.0.0). Also I upgraded the kubernetes object's apiVersion where applicable.

    I did not test it thouroughly. There seem to be bugs, but since I started using kube-prompt just today, I don't even know yet, if these bugs are related to the upgrade. But I suppose this PR is still worthwhile to move towards an up to date kubernetes client.

    • Add dependency to apimachinery; use it for ListOptions

    • Change code to reflect breaking changes of go-client v5.0.0:

      • Enforced explicit references to API group client interfaces in clientsets to avoid ambiguity.
      • Moved pkg/api and pkg/apis to k8s.io/api

      See https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md#v500

    • Rename package imports that have API version as their last label to better reflect which API they represent

    • Migrate objects to newer API versions: Some k8s objects have migrated to newer apiVersions like apps/v1, core/v1.

  • Good News! gcloud will support interactive shell mode.

    Good News! gcloud will support interactive shell mode.

    To all kube-prompt's users

    In public alpha version of gcloud, interactive shell mode is added. This feature provides interactive completion of kubectl's subcommands, not to mention a gcloud's subcommands (See https://cloudplatform.googleblog.com/2018/03/introducing-GCPs-new-interactive-CLI.html for more details)

    Some features still lack but it will be improved in the future (ex: kube-prompt and kube-shell provides feature to complete kubernetes resources such as pods, deployments and so on). It's great news, but it means the worth of kube-prompt will be disappear anymore. Therefore I will not actively develop kube-prompt.

    Thanks.

  • brew: Calling bottle :unneeded is disabled

    brew: Calling bottle :unneeded is disabled

    We get the following error when installing kube-prompt with brew.

    $ brew install c-bata/kube-prompt/kube-prompt
    Error: c-bata/kube-prompt/kube-prompt: Calling bottle :unneeded is disabled! There is no replacement.
    Please report this issue to the c-bata/kube-prompt tap (not Homebrew/brew or Homebrew/core):
      /opt/homebrew/Library/Taps/c-bata/homebrew-kube-prompt/kube-prompt.rb:5
    
  • Provide linux-arm64 binary release on GitHub

    Provide linux-arm64 binary release on GitHub

    Because the cross build is already supported. Could you upload the Linux-arm64 binary to Github release? So I can use the released binary directly in my project.

  • odd view when type `--`

    odd view when type `--`

    Im going to type get pod --namespace XXX but when type get pod --, it show odd view, seems miss a new line: image

    environment: kube-prompt v1.0.4 (rev-61ddcfd) mac item2

  • Looking for co-maintainers

    Looking for co-maintainers

    In response to https://github.com/c-bata/kube-prompt/issues/21 and all kube-prompt's users.

    After publishing kube-prompt, I'm pleased that many users more than I expected use this. But I don't have enough time and mental energy to reply issues, check PRs and update version of kubernetes/client-go. So I'm looking for one or more co-maintainers that can help me.

    If you are interested, please reply to this issue. Thanks.

  • Support for completion of ", and "config use-context "">

    Support for completion of "edit ", and "config use-context "

    First off, great tool, and i like the modular framework of go-prompt.

    This PR adds completion for "edit ", as well as easy switching of context from cluster to cluster via "config use-context ".

    Hopefully someone else finds this useful, as i tend to live in a terminal, and switching from environment to environment for rapid management is fantastic.

  • Fix panic

    Fix panic

    before

    ~ kube-prompt panic: interface conversion: error is *url.Error, not *errors.StatusError

    goroutine 1 [running]: github.com/c-bata/kube-prompt/kube.NewCompleter(0x1ea2a40, 0xc0000fde00, 0xe656a23892ca10dd) /Users/xx/go/src/github.com/c-bata/kube-prompt/kube/completer.go:40 +0x486 main.main() /Users/xx/go/src/github.com/c-bata/kube-prompt/main.go:23 +0x37

    after

    ~ kube-prompt error Get https://192.168.64.7:8443/api/v1/namespaces: dial tcp 192.168.64.7:8443: i/o timeout

  • Panic: : integer divide by zero when running in alpine container

    Panic: : integer divide by zero when running in alpine container

    I am compiling kube-prompt and then running from container. Getting following error as soon as prompt starts.

    bash-5.1# kube-prompt 
    kube-prompt  (rev-)
    Please use `exit` or `Ctrl-D` to exit this program.
    Bye!
    panic: runtime error: integer divide by zero
    
    goroutine 1 [running]:
    github.com/c-bata/go-prompt.(*Render).toPos(...)
            /go/pkg/mod/github.com/c-bata/[email protected]/render.go:269
    github.com/c-bata/go-prompt.(*Render).move(0xc0001dfb18, 0x112521b, 0xc0001dfb18)
            /go/pkg/mod/github.com/c-bata/[email protected]/render.go:258 +0xbb
    github.com/c-bata/go-prompt.(*Render).clear(0xc0003bc5b0, 0x112521b)
            /go/pkg/mod/github.com/c-bata/[email protected]/render.go:245 +0x25
    github.com/c-bata/go-prompt.(*Render).BreakLine(0xc0003bc5b0, 0xc00032dbc0)
            /go/pkg/mod/github.com/c-bata/[email protected]/render.go:229 +0x22d
    github.com/c-bata/go-prompt.(*Prompt).feed(0xc00038b5f0, {0xc000127800, 0x0, 0x400})
            /go/pkg/mod/github.com/c-bata/[email protected]/prompt.go:124 +0x31a
    github.com/c-bata/go-prompt.(*Prompt).Run(0xc00038b5f0)
            /go/pkg/mod/github.com/c-bata/[email protected]/prompt.go:71 +0x539
    main.main()
            /app/kube-prompt/main.go:41 +0x37f
    

    Dockerfile

    FROM golang:1.18-alpine AS builder
    WORKDIR /app
    RUN apk add --no-cache git
    RUN git clone https://github.com/c-bata/kube-prompt.git
    RUN cd kube-prompt && go build -o kube-prompt .
    
    FROM alpine:3.15
    COPY --from=builder /app/kube-prompt/kube-prompt .
    
  • Fetch the latest binary release without arch info

    Fetch the latest binary release without arch info

    Inspired by https://github.com/technosophos/helm-template

    #Stop execution on any error
    trap "fail_trap" EXIT
    set -e
    initArch
    initOS
    verifySupported
    getDownloadURL
    downloadFile
    installFile
    
  • CVE issues

    CVE issues

    A trivy scan of the repo indicates that there a few CVE issues with dependencies (likely k8s libraries). Please consider updating the libraries to address the (>= HIGH) vulnerabilities.

    +-----------------------------+------------------+----------+-----------------------------------+------------------------------------+---------------------------------------+
    |           LIBRARY           | VULNERABILITY ID | SEVERITY |         INSTALLED VERSION         |           FIXED VERSION            |                 TITLE                 |
    +-----------------------------+------------------+----------+-----------------------------------+------------------------------------+---------------------------------------+
    | github.com/dgrijalva/jwt-go | CVE-2020-26160   | HIGH     | 3.2.0+incompatible                | v4.0.0-preview1                    | jwt-go: access restriction            |
    |                             |                  |          |                                   |                                    | bypass vulnerability                  |
    |                             |                  |          |                                   |                                    | -->avd.aquasec.com/nvd/cve-2020-26160 |
    +-----------------------------+------------------+          +-----------------------------------+------------------------------------+---------------------------------------+
    | golang.org/x/crypto         | CVE-2020-29652   |          | 0.0.0-20190820162420-60c769a6c586 | v0.0.0-20201216223049-8b5274cf687f | golang: crypto/ssh: crafted           |
    |                             |                  |          |                                   |                                    | authentication request can            |
    |                             |                  |          |                                   |                                    | lead to nil pointer dereference       |
    |                             |                  |          |                                   |                                    | -->avd.aquasec.com/nvd/cve-2020-29652 |
    +                             +------------------+          +                                   +------------------------------------+---------------------------------------+
    |                             | CVE-2020-9283    |          |                                   | v0.0.0-20200220183623-bac4c82f6975 | golang.org/x/crypto: Processing       |
    |                             |                  |          |                                   |                                    | of crafted ssh-ed25519                |
    |                             |                  |          |                                   |                                    | public keys allows for panic          |
    |                             |                  |          |                                   |                                    | -->avd.aquasec.com/nvd/cve-2020-9283  |
    +-----------------------------+------------------+----------+-----------------------------------+------------------------------------+---------------------------------------+
    
  • Is it possible to have Vi mode like Vi mode in Bash?

    Is it possible to have Vi mode like Vi mode in Bash?

    If you only want to use this mode in Bash, an alternative is to use the following in your .bashrc, again with a login/logout or resourcing of the file:

    set -o vi
    
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.

May 19, 2021
An Easy to use Go framework for Kubernetes based on kubernetes/client-go

k8devel An Easy to use Go framework for Kubernetes based on kubernetes/client-go, see examples dir for a quick start. How to test it ? Download the mo

Mar 25, 2022
Kube - A simple Kubernetes client, based on client-go

kube A simple Kubernetes client, based on client-go.

Aug 9, 2022
Provides an interactive prompt to connect to ECS Containers using the ECS ExecuteCommand API.
Provides an interactive prompt to connect to ECS Containers using the ECS ExecuteCommand API.

ecsgo Heavily inspired by incredibly useful gossm, this tool makes use of the new ECS ExecuteCommand API to connect to running ECS tasks. It provides

Dec 12, 2022
ArgoCD is widely used for enabling CD GitOps. ArgoCD internally builds manifest from source data in Git repository, and auto-sync it with target clusters.
ArgoCD is widely used for enabling CD GitOps. ArgoCD internally builds manifest from source data in Git repository, and auto-sync it with target clusters.

ArgoCD Interlace ArgoCD is widely used for enabling CD GitOps. ArgoCD internally builds manifest from source data in Git repository, and auto-sync it

Dec 14, 2022
Go (golang) Jupyter Notebook kernel and an interactive REPL
Go (golang) Jupyter Notebook kernel and an interactive REPL

lgo Go (golang) Jupyter Notebook kernel and an interactive REPL Disclaimer Since go1.10, this Go kernel has performance issue due to a performance reg

Jan 1, 2023
Cloud Service Auto Cert

CSAC (Cloud Service Auto Cert) Features Tencent Cloud Auto DNS Certification Auto Upload Cert File Auto Update CDN HTTPS Cert Auto Update CLB HTTPS Ce

May 6, 2022
App for VMware Workstartion to auto start VM's on windows reboot

VMware Workstation AutoStart This is an auto start app for VMware Workstation to auto start VM's on windows reboot with VMware Workstation installed.

Dec 15, 2021
Aws asg updater - Update AMIs within AWS Auto Scaling groups automatically.

AWS Auto Scaling Groups Updater AWS Auto Scaling group is a great way of managing Amazon EC2 instances. AWS Auto Scaling group watches the correspondi

Oct 7, 2022
Create AWS Auto Scaling groups from running instances or AMIs automatically.

AWS Auto Scaling Groups Builder AWS Auto Scaling group is a great way of managing Amazon EC2 instances. AWS Auto Scaling group watches the correspondi

Oct 7, 2022
Rotate is a tool for rotating out AWS Auto-Scaling Groups within a k8s cluster

k8s-r8 rotate is a tool for rotating out AWS Auto-Scaling Groups within a k8s cluster. It was developed to make upgrading AMIs as a one command experi

Mar 27, 2022
AutoGpuAffinity - Auto Gpu Affinity with golang
AutoGpuAffinity - Auto Gpu Affinity with golang

AutoGpuAffinity The idea and concept is from AMIT (repository) Formulas for calc

Dec 15, 2022
Litmus helps Kubernetes SREs and developers practice chaos engineering in a Kubernetes native way.
Litmus helps Kubernetes SREs and developers practice chaos engineering in a Kubernetes native way.

Litmus Cloud-Native Chaos Engineering Read this in other languages. ???? ???? ???? ???? Overview Litmus is a toolset to do cloud-native chaos engineer

Jan 1, 2023
KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes
 KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes

Kubernetes-based Event Driven Autoscaling KEDA allows for fine-grained autoscaling (including to/from zero) for event driven Kubernetes workloads. KED

Jan 7, 2023
vcluster - Create fully functional virtual Kubernetes clusters - Each cluster runs inside a Kubernetes namespace and can be started within seconds
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

Jan 4, 2023
network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of kubernetes.
network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of kubernetes.

Network Node Manager network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of ku

Dec 18, 2022
A k8s vault webhook is a Kubernetes webhook that can inject secrets into Kubernetes resources by connecting to multiple secret managers
A k8s vault webhook is a Kubernetes webhook that can inject secrets into Kubernetes resources by connecting to multiple secret managers

k8s-vault-webhook is a Kubernetes admission webhook which listen for the events related to Kubernetes resources for injecting secret directly from sec

Oct 15, 2022
Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes.
Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes.

Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes. This project is inspired by agones. Introduction Genera

Nov 25, 2022
Kubei is a flexible Kubernetes runtime scanner, scanning images of worker and Kubernetes nodes providing accurate vulnerabilities assessment, for more information checkout:
Kubei is a flexible Kubernetes runtime scanner, scanning images of worker and Kubernetes nodes providing accurate vulnerabilities assessment, for more information checkout:

Kubei is a vulnerabilities scanning and CIS Docker benchmark tool that allows users to get an accurate and immediate risk assessment of their kubernet

Dec 30, 2022