Save logs of previous restart of containers

We save logs of all containers running on our K8s, but sometimes those
containers are restarted. To increase debugging abilities this commit
makse sure to also save the logs of previous run of the service.

Change-Id: Ic6a0d72de1b64b1217164f2e75b5a3e018f5a4ce
This commit is contained in:
Michał Dulko 2019-08-28 14:48:40 +02:00
parent b6facd57e6
commit 8c756bd05b

View File

@ -45,6 +45,7 @@ do
for container in ${containers}
do
/usr/local/bin/kubectl --kubeconfig=${HOME}/.kube/config logs -n ${namespace} -c ${container} ${name} >> ${K8S_LOG_DIR}/pod_logs/${namespace}-${name}-${container}.txt
/usr/local/bin/kubectl --kubeconfig=${HOME}/.kube/config logs -n ${namespace} -p -c ${container} ${name} >> ${K8S_LOG_DIR}/pod_logs/${namespace}-${name}-${container}-prev.txt
done
done < <(/usr/local/bin/kubectl get pods -o=custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace --all-namespaces | tail -n +2)