<p>I try to deploy my tomcat on kubernetes but when I run : <code>kubectl create -f deploy-tomcat.yaml</code> I have always the same error :</p>
<pre><code>error from server (need to declare liveness (found 0), need to declare readiness (found 0)
</code></pre>
<p>deploy-tomcat.yaml :</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: tomcat-deployment
  labels:
    app: tomcat
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tomcat
  template:
    metadata:
      labels:
        app: tomcat
    spec:
      containers:
      - name: tomcat
        image: tomcat-image
        ports:
        - containerPort: 8080
</code></pre>

rodolf12343
<p>I suggest you add a liveness and readinessProbe to your manifest (on <code>containers</code> level), e.g.:</p>
<pre><code>  readinessProbe:
    tcpSocket:
      port: 8080
  livenessProbe:
    tcpSocket:
      port: 8080
</code></pre>
<p><strong>Please note</strong>, that this is not K8s default behavior to enforce the existence of those probes. I assume it was added to your K8s cluster with a <a href="https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#validatingadmissionwebhook" rel="nofollow noreferrer">validating admission webhook</a>.</p>
