Description
Kubernetes check fails to get pod logs if cluster cannot start.
Defaulted container "scm" out of: scm, init (init) Error from server (BadRequest): container "scm" in pod "scm-0" is waiting to start: PodInitializing
get_logs() { mkdir -p logs for pod in $(kubectl get pods -o custom-columns=NAME:.metadata.name | tail -n +2); do for initContainer in $(kubectl get pod -o jsonpath='{.spec.initContainers[*].name}' "${pod}"); do kubectl logs "${pod}" "${initContainer}" > logs/"pod-${pod}-${initContainer}.log" done kubectl logs "${pod}" > logs/"pod-${pod}.log" done }