You want to make sure that if the applications running inside some of your pods get into a broken state, Kubernetes restarts the pods automatically.
#Example of linveness
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: podliveness
name: podliveness
spec:
replicas: 1
selector:
matchLabels:
app: podliveness
strategy: {}
template:
metadata:
labels:
app: podliveness
spec:
containers:
- image: busybox
name: busybox
args:
- /bin/sh
- -c
- touch webapp; sleep 20; rm -f webapp; sleep 600
livenessProbe:
exec:
command:
- cat
- webapp
initialDelaySeconds: 5
periodSeconds: 3
No comments:
Post a Comment