Skip to main content

Kubernetes utility for viewing pod and failed replicaset events

Project description

kge-kubectl-get-events

A kubernetes utility for viewing pod and failed replicaset events in a user-friendly way. There are many problems that are most easily fixed by understanding the recent events.

Table of Contents

Motivation/Alternatives

The best alternative to this tool is:

alias kge="kubectl get events --sort-by=lastTimestamp --field-selector type!=Normal"

The problem with kubectl get events is that autocompletion doesn't work.

For example, this utility runs the command:

kubectl get events --field-selector involvedObject.name=busybox-deployment-7f49499c8

like this:

kge <tab><tab>

Saving loads of time.

Installation

pipx install kge-kubectl-get-events

Usage

Fastest path to what you want

Show all pods with abnormal events:

kge -ea

Interactive Mode

Run the tool without arguments to enter interactive mode:

kge

View Events for All Pods

View events for all pods in the current namespace:

kge -a
# or
kge --all

View Events for a Specific Pod

View events for a specific pod:

kge <pod-name>

View Non-Normal Events

View only non-normal events (warnings and errors) for all pods:

kge --exceptions-only
# or
kge -e

In interactive mode, you can select "All pods with non-normal events" from the menu.

Specify Namespace

View events from a specific namespace:

kge -n mynamespace
# or
kge --namespace mynamespace

You can combine this with other options:

# View all events in a specific namespace
kge -A -n mynamespace

# View non-normal events in a specific namespace
kge -e -n mynamespace

# View events for a specific pod in a specific namespace
kge -n mynamespace my-pod

This will display a menu of all pods in the current namespace, allowing you to select which pod's events to view. The menu includes an option to view all non-normal events.

Shell Completion

The tool supports shell completion for pod names. To enable it:

For zsh

Add the following to your shell configuration:

source <(kge --completion=zsh)

Alternatively, add the completion script directly to your zsh configuration:

compdef _kge kge
_kge() {
    local -a pods
    pods=($(kge --complete))
    _describe 'pods' pods
}

Command-line Options

Option Description
-A, --all Get events for all pods in the current namespace
-n, --namespace Specify the namespace to use
-e, --exceptions-only Show only non-normal events (warnings and errors)
--complete List pods for shell completion (internal use)
--completion=zsh Generate zsh completion script

Features

  • View events for all pods in a namespace
  • View events for a specific pod
  • View only non-normal events (warnings and errors)
  • Specify custom namespace
  • Interactive pod selection
  • Shell completion support
  • Automatic namespace detection
  • Caching for better performance

Requirements

  • Python 3.6 or higher
  • Valid Kubeconfig in the environment

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kge_kubectl_get_events-0.4.1.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kge_kubectl_get_events-0.4.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file kge_kubectl_get_events-0.4.1.tar.gz.

File metadata

  • Download URL: kge_kubectl_get_events-0.4.1.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for kge_kubectl_get_events-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0dc2f9c16b5aed58f2a5bdaed7edef337d17e051b8d25c34f0a61bbc3adfc495
MD5 c054d8dcb71206369791d5ce590f9f7b
BLAKE2b-256 42635c87f190731aef780392e0b247e206956048cb40d0610a4a430e10e429ec

See more details on using hashes here.

File details

Details for the file kge_kubectl_get_events-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for kge_kubectl_get_events-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1f8bd086c9ca9bf57ef9dc14adbaf43e64f89a9cf4af8fd4e971278c683b10d4
MD5 fb3fc7b1efb9572fddbcfd9feffa46a8
BLAKE2b-256 68cd133042a8250c6fe903d5d027be8c42e1af2d4576dfdc58e858588e78b7a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page