[Kubernates][Linux] check stdout log and restart

apiVersion: v1
kind: Pod
metadata:
  name: your-pod
spec:
  containers:
  - name: your-container
    image: your-image
  - name: log-monitor
    image: busybox
    command:
      - /bin/sh
      - -c
      - |
        tail -F /proc/1/fd/1 | \
        while read line; do
          echo $line | grep -q 'java.lang.OutOfMemoryError: Java heap space' && \
          kill 1
        done

Last updated

Was this helpful?