From 5291dd53fdf6cee63a83a818da08f48b47bbb9a7 Mon Sep 17 00:00:00 2001 From: ujwal pachghare <131592212+Uj5Ghare@users.noreply.github.com> Date: Sun, 8 Dec 2024 17:48:54 +0530 Subject: [PATCH] feat(k8) Added k8s/manifests for frontend and backend --- k8s/manifests/backend/deployment.yml | 29 +++++++++++++++++++++++++++ k8s/manifests/backend/hpa.yml | 25 +++++++++++++++++++++++ k8s/manifests/backend/service.yml | 16 +++++++++++++++ k8s/manifests/frontend/deployment.yml | 29 +++++++++++++++++++++++++++ k8s/manifests/frontend/hpa.yml | 25 +++++++++++++++++++++++ k8s/manifests/frontend/service.yml | 16 +++++++++++++++ 6 files changed, 140 insertions(+) create mode 100644 k8s/manifests/backend/deployment.yml create mode 100644 k8s/manifests/backend/hpa.yml create mode 100644 k8s/manifests/backend/service.yml create mode 100644 k8s/manifests/frontend/deployment.yml create mode 100644 k8s/manifests/frontend/hpa.yml create mode 100644 k8s/manifests/frontend/service.yml diff --git a/k8s/manifests/backend/deployment.yml b/k8s/manifests/backend/deployment.yml new file mode 100644 index 0000000..8941570 --- /dev/null +++ b/k8s/manifests/backend/deployment.yml @@ -0,0 +1,29 @@ +# This is a sample deployment manifest file for a simple web application. +apiVersion: apps/v1 +kind: Deployment +metadata: + name: node-deployment + namespace: app + labels: + app: node +spec: + replicas: 2 + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 25% + selector: + matchLabels: + app: node + template: + metadata: + labels: + app: node + spec: + containers: + - name: node-con + image: uj5ghare/eng-backend:latest + ports: + - containerPort: 8000 + imagePullPolicy: Always \ No newline at end of file diff --git a/k8s/manifests/backend/hpa.yml b/k8s/manifests/backend/hpa.yml new file mode 100644 index 0000000..9bd5943 --- /dev/null +++ b/k8s/manifests/backend/hpa.yml @@ -0,0 +1,25 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: node-hpa + namespace: app +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: node-deployment + minReplicas: 1 + maxReplicas: 3 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 80 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 80 diff --git a/k8s/manifests/backend/service.yml b/k8s/manifests/backend/service.yml new file mode 100644 index 0000000..c3a79af --- /dev/null +++ b/k8s/manifests/backend/service.yml @@ -0,0 +1,16 @@ +# Service for the application +apiVersion: v1 +kind: Service +metadata: + name: node-svc + namespace: app + labels: + app: node +spec: + ports: + - port: 80 + targetPort: 8000 + protocol: TCP + selector: + app: node + type: ClusterIP \ No newline at end of file diff --git a/k8s/manifests/frontend/deployment.yml b/k8s/manifests/frontend/deployment.yml new file mode 100644 index 0000000..1e2eb35 --- /dev/null +++ b/k8s/manifests/frontend/deployment.yml @@ -0,0 +1,29 @@ +# This is a sample deployment manifest file for a simple web application. +apiVersion: apps/v1 +kind: Deployment +metadata: + name: react-deployment + namespace: app + labels: + app: react +spec: + replicas: 2 + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 25% + selector: + matchLabels: + app: react + template: + metadata: + labels: + app: react + spec: + containers: + - name: react-con + image: uj5ghare/eng-frontend:latest + ports: + - containerPort: 3000 + imagePullPolicy: Always \ No newline at end of file diff --git a/k8s/manifests/frontend/hpa.yml b/k8s/manifests/frontend/hpa.yml new file mode 100644 index 0000000..6f5f082 --- /dev/null +++ b/k8s/manifests/frontend/hpa.yml @@ -0,0 +1,25 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: react-hpa + namespace: app +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: react-deployment + minReplicas: 1 + maxReplicas: 3 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 80 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 80 diff --git a/k8s/manifests/frontend/service.yml b/k8s/manifests/frontend/service.yml new file mode 100644 index 0000000..eb70a6e --- /dev/null +++ b/k8s/manifests/frontend/service.yml @@ -0,0 +1,16 @@ +# Service for the application +apiVersion: v1 +kind: Service +metadata: + name: react-svc + namespace: app + labels: + app: react +spec: + ports: + - port: 80 + targetPort: 3000 + protocol: TCP + selector: + app: react + type: ClusterIP \ No newline at end of file