[Create the Pod]
$ kubectl apply -f emptyDir_1.yaml
$ kubectl apply -f https://k8s.io/examples/pods/storage/redis.yaml

[Verify that the Pods Container is running, and then watch for changes to the Pod]
$ kubectl get pod redis --watch
NAME      READY     STATUS    RESTARTS   AGE
redis     1/1       Running   0          13s

[Get a shell to the running Container]
$ kubectl exec -it redis -- /bin/bash
  root@redis:/data# cd /data/redis/                                             # go to /data/redis, and then create a file
  root@redis:/data/redis# echo Hello > test-file
  root@redis:/data/redis# apt-get update
  root@redis:/data/redis# apt-get install procps
  root@redis:/data/redis# ps aux
  USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
  redis        1  0.1  0.1  33308  3828 ?        Ssl  00:46   0:00 redis-server *:6379
  root        12  0.0  0.0  20228  3020 ?        Ss   00:47   0:00 /bin/bash
  root        15  0.0  0.0  17500  2072 ?        R+   00:48   0:00 ps aux
  root@redis:/data/redis# kill PID_NO                                           # where PID_NO is the Redis process ID (PID)
  NAME      READY     STATUS     RESTARTS   AGE
  redis     1/1       Running    0          13s
  redis     0/1       Completed  0         6m
  redis     1/1       Running    1         6m

Container has terminated and restarted. This is because the Redis Pod has a restartPolicy of "Always".

[Get a shell to the after restarted running Container]
$ kubectl exec -it redis -- /bin/bash
  root@redis:/data/redis# cd /data/redis/                                       # go to /data/redis, and verify that test-file is still there
  root@redis:/data/redis# ls
  test-file

[Delete the Pod]
$ kubectl delete pod redis
