Skip to content

Instantly share code, notes, and snippets.

View martibutler's full-sized avatar

Marti B martibutler

View GitHub Profile
kubectl get po --all-namespaces | awk '{if ($4 ~ /Error/ && $1 ~ /^fe-/) system ("kubectl -n " $1 " logs -f "$2)}'
@martibutler
martibutler / read_pod_logs.php
Created June 4, 2019 13:07
Read logs from K8s Error pods
<?php
$errorPods = `kubectl get pods -o wide --sort-by="{.spec.nodeName}" --all-namespaces | grep Error`;
$lines = explode("\n",trim($errorPods));
foreach ($lines as $line) {
$bits = explode(" ",preg_replace("/[\ ]+/"," ",$line));
echo "Starting NS ".$bits[0]." and POD ".$bits[1]."\n";
$cmd = "kubectl -n ".$bits[0]." logs -f ".$bits[1];
@martibutler
martibutler / keybase.md
Created October 12, 2017 15:18
Ma Keybase

Keybase proof

I hereby claim:

  • I am martibutler on github.
  • I am martibutler (https://keybase.io/martibutler) on keybase.
  • I have a public key ASDwJKOeRhjgs3042AS6M1wmQa8aGdXrYB8scM9GRitysAo

To claim this, I am signing this object: