<p>I am trying to deploy my kubernetes deployment resource with defining liveness probe and readyness. </p>

<p>When I am trying to deploy my deployment with api version <code>app/v1</code>, at that time I am getting the error like the following,</p>

<pre><code>Unknown field "readinessProbe" in io.k8s.api.core.v1.ContainerPort
</code></pre>

<p>So after that I changed my api version to <code>v1</code>. And then I am getting the error like the following,</p>

<pre><code>Error: unable to recognize "deployment/deployment.yaml": no matches for kind "Deployment" in version "v1"
</code></pre>

<p>my <strong>deployment.yaml</strong> is ,</p>

<pre><code>apiVersion: v1
kind: Deployment
metadata:
  name: spacestudyadminaccountmaintenance-deployment
  labels:
    app: spacestudyadminaccountmaintenance-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: spacestudyadminaccountmaintenance-deployment
  template:
    metadata:
      labels:
        app: spacestudyadminaccountmaintenance-deployment
      annotations: 
        date: "+%H:%M:%S %d/%m/%y"
    spec:
      imagePullSecrets:
        - name: "regcred"
      containers:
       - name: spacestudyadminaccountmaintenance-deployment-container
         image: spacestudymilletech010/spacestudyadminaccountmaintenance:latest
         imagePullPolicy: Always
         ports:
            - name: http
              containerPort: 7081
              readinessProbe:
                tcpSocket:
                  port: 7081
                initialDelaySeconds: 5
                periodSeconds: 10
             livenessProbe:
               tcpSocket:
                 port: 7081
               initialDelaySeconds: 15
               periodSeconds: 20
        nodeSelector:
          tenantName: tenant1
</code></pre>

<p>So which kubernetes resource api version that I should define for using the liveness and readyness for my deployment here ? </p>

Mr.DevEng
<p>As @Radu pointed out, its due to <strong>indentation</strong>. <code>kubectl explain</code> command would be useful here</p>

<p><code>kubectl explain deployment.spec.template.spec.containers --recursive</code> 
with this command you can check the correct place for the each field </p>

<pre><code> args &lt;[]string&gt;
   command      &lt;[]string&gt;
   env  &lt;[]Object&gt;
      name      &lt;string&gt;
      value     &lt;string&gt;
      valueFrom &lt;Object&gt;
         configMapKeyRef        &lt;Object&gt;
            key &lt;string&gt;
            name        &lt;string&gt;
            optional    &lt;boolean&gt;
         fieldRef       &lt;Object&gt;
            apiVersion  &lt;string&gt;
            fieldPath   &lt;string&gt;
         resourceFieldRef       &lt;Object&gt;
            containerName       &lt;string&gt;
            divisor     &lt;string&gt;
            resource    &lt;string&gt;
         secretKeyRef   &lt;Object&gt;
            key &lt;string&gt;
            name        &lt;string&gt;
            optional    &lt;boolean&gt;
   envFrom      &lt;[]Object&gt;
      configMapRef      &lt;Object&gt;
         name   &lt;string&gt;
         optional       &lt;boolean&gt;
      prefix    &lt;string&gt;
      secretRef &lt;Object&gt;
         name   &lt;string&gt;
         optional       &lt;boolean&gt;
   image        &lt;string&gt;
   imagePullPolicy      &lt;string&gt;

</code></pre>
