Skip to content

Instantly share code, notes, and snippets.

@jsturtevant
Created February 12, 2019 05:55
Show Gist options
  • Save jsturtevant/25aee565396669eb8018f5b29c2133c1 to your computer and use it in GitHub Desktop.
Save jsturtevant/25aee565396669eb8018f5b29c2133c1 to your computer and use it in GitHub Desktop.
runs netstat after a pod is killed
$dt = (Get-Date).ToString("MM-dd-yyyy HH:mm:ss")
$events=(.\kubectl.exe --kubeconfig='config' get events -o json | ConvertFrom-Json).items
Write-output "processing events"
ForEach ($event in $events) {
Write-output $event.reason
if ($event.reason -eq "Killing"){
#$message="found event at $dt"
Write-Output $dt | Out-File -FilePath test -Append
Write-output $event | Out-file -FilePath test -Append
netstat -p tcp -noa | Out-File -FilePath test -Append
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment