<p>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?</p>

<p>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:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: &lt;appdeployment&gt;
  labels:
    app: &lt;appname&gt;
spec:
  replicas: 3
  selector:
    matchLabels:
      app: &lt;appname&gt;
  template:
    metadata:
      labels:
        app: &lt;appname&gt;
    spec:
      containers:
      - image: "registry.hub.docker.com/imagename"
        name: &lt;appname&gt;-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
</code></pre>

<p>It fails with error: error parsing .yaml: error converting YAML to JSON: yaml: line 22: found character that cannot start any token</p>

<p>That line is the definition of the readiness probe.</p>

John Sheppard
<p>You can use the command <code>kubectl edit deployment deploymentname -n namespacename</code> which will open up an editor where you can edit the yaml to add readiness probe and liveness probe and saving it will directly apply the changes to the cluster.</p>

<p>Alternatively you can use <code>kubectl get deployment deploymentname -n namespacename -o yaml &gt; deployment.yaml</code> to save the deployment in yaml file and edit it to add readiness probe and liveness probe and then <code>kubectl apply -f deployment.yaml</code> to deploy the changes to the cluster.</p>
