How to: watch events for updates
kubectl get events --watch
```

1. Using the official manifest file `pods/probe/exec-liveness.yaml` as base, create a Deployment `myapp` manifest file as follows:
   - busybox image
   - commandline arguments `mkdir /tmp/healthy; sleep 30; rm -d /tmp/healthy; sleep 60; mkdir /tmp/healthy; sleep 600;`
   - a _liveness probe_ that checks for the presence of `/tmp/healthy` directory
   - the Probe should be initiated 10secs after container starts
   - the Probe should perform the checks every 10secs
   > the container creates a directory `/tmp/healthy` on startup, deletes the directory 30secs later, recreates the directory 60secs later \
   > your goal is to monitor the Pod behaviour/statuses during these events, you can repeat this lab until you understand liveness probes
2. Apply the manifest file to create the Deployment
3. Review and monitor created Pod events for 3-5mins
4. Delete created resources
lab12.1 solution
```sh
kubectl create deploy myapp --image=busybox --dry-run=client -oyaml -- /bin/sh -c "touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 60; touch /tmp/healthy; sleep 600;" >lab12-1.yml
wget -qO- https://k8s.io/examples/pods/probe/exec-liveness.yaml | less # copy the liveness probe section
nano lab12-1.yml # paste, edit and fix indentation
```

```yaml
kind: Deployment
spec:
  template:
    spec:
      containers:
        livenessProbe:
          exec:
            command:
            - ls # `cat` for file
            - /tmp/healthy
          initialDelaySeconds: 10
          periodSeconds: 10
```

```sh
kubectl apply -f lab12-1.yml
kubectl get po # find pod name
kubectl get events --field-selector=involvedObject.name=$POD_NAME --watch
kubectl delete -f lab12-1.yml
```