pod-watcher

command module
v0.0.0-...-b307869 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Pod Watcher version rating

Pod Watcher is a simple program to monitor Kubernetes pods and log their events such as creation, deletion, and updates.

Features

  • Logs pod creation, deletion, and updates.
  • Option to print detailed pod object information.
  • Filters pods based on namespace and label selector.

Requirements

  • Go 1.22 or later
  • Kubernetes cluster
  • kubeconfig file for authentication (if running outside a cluster)

Installation

  1. Clone the repository:

    git clone https://github.com/OsmanTunahan/pod-watcher.git
    cd pod-watcher
    
  2. Build the project:

    go build -o pod-watcher
    

Usage

Command-line Options
  • --kubeconfig (string): Absolute path to the kubeconfig file (optional if running inside a cluster).
  • --namespace (string): Namespace to watch (default: all namespaces).
  • --details (bool): Print detailed pod object information (default: false).
  • --selector (string): Label selector to filter pods (default: "foo=bar,baz=quux").
Running the Program
  1. Ensure you have access to your Kubernetes cluster either by running inside the cluster or by providing a valid kubeconfig file.

  2. Run the program:

    ./pod-watcher --kubeconfig=~/.kube/config --namespace=default --details=true --selector="app=testk8sapp"
    
Example

To watch all pods in the default namespace with detailed logging enabled:

./pod-watcher --namespace=default --details=true

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址