Last active
March 14, 2019 00:25
-
-
Save nottrobin/2cc84fa4e0426be06cd603c00dac59ba to your computer and use it in GitHub Desktop.
Get first non-ready kubernetes pod
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
app=maas.io | |
deployment_failed_reason=$(kubectl get deployment --namespace staging --selector app=${app} -o=jsonpath='{.items[0].status.conditions[1].reason}') | |
if [ "${deployment_failed_reason}" == "ProgressDeadlineExceeded" ]; then | |
non_ready_pod=$(kubectl get pod --namespace staging --selector app=${app} --output json | jq -r '(.items | map(select(.status.containerStatuses[0].ready==false)))[0].metadata.name') | |
kubectl logs ${non_ready_pod} --namespace staging | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment