Created
April 17, 2020 18:25
-
-
Save viggin543/01b6e87e675c4b76d67e9d2bfccdb32d to your computer and use it in GitHub Desktop.
a script that messures the time it takes to a single pod to become redy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
pod=$1 | |
scheduled=`kubectl get pod $pod -o json | jq -r '.status.conditions[] | select(.type=="PodScheduled") | .lastTransitionTime' | sed 's/T/ /g' | tr -d 'Z'` | |
ready=`kubectl get pod $pod -o json | jq -r '.status.conditions[] | select(.type=="Ready") | .lastTransitionTime' | sed 's/T/ /g' | tr -d 'Z'` | |
scheduled_epoch=`date -j -u -f "%Y-%m-%d %T" "$scheduled" "+%s"` # mac os date ( linux has different | |
echo "${pod} sechedualed at ${scheduled_epoch}" | |
ready_epoch=`date -j -u -f "%Y-%m-%d %T" "$ready" "+%s"` | |
load_seconds=$((ready_epoch-scheduled_epoch)) | |
echo "${pod} launch time: ${load_seconds} seconds" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment