I have created a Kubernetes deployment with pods defined by a template. I need to update the pod definition to include readiness and liveliness probes because the template doesn't allow the creation of these probes as far as I can tell. Any ideas?
The problem with the deployment is that it won't let me add in probe definitions. If I use a probe definition like the following:
apiVersion: apps/v1
kind: Deployment
metadata:
name: <appdeployment>
labels:
app: <appname>
spec:
replicas: 3
selector:
matchLabels:
app: <appname>
template:
metadata:
labels:
app: <appname>
spec:
containers:
- image: "registry.hub.docker.com/imagename"
name: <appname>-image
readinessProbe:
httpGet:
path: /healthz
port: 80
initialDelaySeconds: 90
periodSeconds: 5
failureThreshold: 20
ports:
- containerPort: 80
protocol: TCP
resources:
requests:
cpu: 1000m
limits:
cpu: 4000m
It fails with error: error parsing .yaml: error converting YAML to JSON: yaml: line 22: found character that cannot start any token
That line is the definition of the readiness probe.