December
2nd,
2019
Terminate a sidecar container in Kubernetes
kubectl apply -f great-job.yaml
➜ ~ kubectl get pods
NAME READY STATUS RESTARTS AGE
great-job-1575331260-mjl68 0/2 Completed 0 2m28s
great-job-1575331320-p6srg 0/2 Completed 0 88s
great-job-1575331380-xqk49 0/2 Completed 0 28s
➜ ~ kubectl logs -f great-job-1575331380-xqk49 -c count-log
0: Tue Dec 3 00:03:12 UTC 2019
1: Tue Dec 3 00:03:13 UTC 2019
2: Tue Dec 3 00:03:14 UTC 2019
3: Tue Dec 3 00:03:15 UTC 2019
4: Tue Dec 3 00:03:16 UTC 2019
5: Tue Dec 3 00:03:17 UTC 2019
6: Tue Dec 3 00:03:18 UTC 2019
7: Tue Dec 3 00:03:19 UTC 2019
8: Tue Dec 3 00:03:20 UTC 2019
9: Tue Dec 3 00:03:21 UTC 2019
Killed 7 because the main container terminated.
Based on Medium from Koji Nishikiori
You can download Gist