Trying to create liveness command with exec-liveness.yaml.
kubectl create -f exec-liveness.yaml
apiVersion: v1
kind: Pod
metadata:
labels:
test: liveness
name: liveness-exec
spec:
containers:
- name: liveness
image: k8s.gcr.io/busybox
args:
- /bin/sh
- -c
- touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600
livenessProbe:
exec:
command:
- cat
- /tmp/healthy
initialDelaySeconds: 3
periodSeconds: 5
Do I try to fix the errors, or turn off validation?
Hi Paul,
The indentation is wrong.
The stuff after this line relates to the container so should be indented to line up with name
Kind regards,
Stephen
Looks lined up to me.
I have since copied the file from the Kubernetes docs and it worked. thanks
Just for reference, this is what I meant about indenting to be inline with name
containers
is an array of container specs objects, and each objectis indented with a -
, so for example if the pod had 2 containers it would look like:
spec:
containers:
- name: container1
image: image1
livenessProbe:
exec:
command:
- cat
- /tmp/healthy
initialDelaySeconds: 3
periodSeconds: 5
- name: container2
image: image2
Kind regards,
Stephen