rodolf12343
rodolf12343

Reputation: 3

Kubernetes deploy tomcat probleme about liveness and readiness

I try to deploy my tomcat on kubernetes but when I run : kubectl create -f deploy-tomcat.yaml I have always the same error :

error from server (need to declare liveness (found 0), need to declare readiness (found 0)

deploy-tomcat.yaml :

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

Upvotes: 0

Views: 328

Answers (1)

Fritz Duchardt
Fritz Duchardt

Reputation: 11930

I suggest you add a liveness and readinessProbe to your manifest (on containers level), e.g.:

  readinessProbe:
    tcpSocket:
      port: 8080
  livenessProbe:
    tcpSocket:
      port: 8080

Please note, 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 validating admission webhook.

Upvotes: 2

Related Questions