diff --git a/Dockerfile b/Dockerfile index 360b8d2..c31ccd1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,6 @@ # Use the official OpenJDK 17 image as the base image -FROM openjdk:17-jdk-alpine - -# Set metadata -LABEL maintainer="trainwithshubham@gmail.com" -LABEL version="1.0" -LABEL description="A Java Quotes application" +# Dockerfile: Line 2 (Change this line) +FROM eclipse-temurin:21-jdk-alpine # Set the working directory inside the container WORKDIR /app diff --git a/deployment.yml b/deployment.yml new file mode 100644 index 0000000..7e7e14d --- /dev/null +++ b/deployment.yml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: quotes-app + namespace: quoteapp + labels: + app: quotes + +spec: + replicas: 2 + selector: + matchLabels: + app: quotes + tier: backend + template: + metadata: + labels: + app: quotes + tier: backend + spec: + containers: + + - name: quotes-app + image: quotesapp:latest + ports: + - containerPort: 8000 + + + livenessProbe: + httpGet: + path: /healthz + port: 8000 + initialDelaySeconds: 20 + periodSeconds: 5 + timeoutSeconds: 5 + failureThreshold: 3 + + + readinessProbe: + httpGet: + path: /ready + port: 8000 + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 3 + failureThreshold: 1 diff --git a/namespaces.yml b/namespaces.yml new file mode 100644 index 0000000..fe29ac4 --- /dev/null +++ b/namespaces.yml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: quoteapp diff --git a/pod.yml b/pod.yml new file mode 100644 index 0000000..2e84606 --- /dev/null +++ b/pod.yml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Pod +metadata: + name: quote-pod + namespace: quoteapp + labels: + app: quotes + tier: backend +spec: + containers: + - name: quotes-app + image: quotesapp:latest + imagePullPolicy: Never + ports: + - containerPort: 8000 + resources: + requests: + memory: "256Mi" + cpu: "100m" + limits: + memory: "512Mi" + cpu: "500m" + diff --git a/service.yml b/service.yml new file mode 100644 index 0000000..5e9b110 --- /dev/null +++ b/service.yml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: quotes-service + namespace: quoteapp + labels: + app: quotes + tier: backend +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 8000 + protocol: TCP + name: http + selector: + app: quotes + tier: backend