Skip to content

Instantly share code, notes, and snippets.

@makkes
Created August 9, 2022 11:39
Show Gist options
  • Save makkes/92b07b5ad53eea49b63dfe37269c8afc to your computer and use it in GitHub Desktop.
Save makkes/92b07b5ad53eea49b63dfe37269c8afc to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#
# A silly little kubectl plugin helping you become more intimate with your Kubernetes
# cluster.
#
# 1. Download the file
# 2. Put it somewhere within your `$PATH`
# 3. Make it executable
# 4. `kubectl im-feeling-lucky`
NS=$(kubectl get ns -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | shuf | head -1)
RES=$(kubectl api-resources -o name | shuf | head -1)
CMD="kubectl -n $NS get $RES"
echo $CMD
$CMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment