81 lines
1.9 KiB
YAML
81 lines
1.9 KiB
YAML
# eCommerce Customer Website — Deployment + NodePort Service
|
|
#
|
|
# BEFORE BUILDING THE IMAGE:
|
|
# The API URL is baked into the JS bundle at Docker build time by Vite.
|
|
# You MUST build the image with the real backend URL:
|
|
#
|
|
# docker build \
|
|
# --build-arg VITE_API_BASE_URL=http://<NODE_IP>:30300/api \
|
|
# -t ecommerce-web:latest \
|
|
# ./eCommerce-website
|
|
#
|
|
# BEFORE APPLYING:
|
|
# Set image: to your built image name.
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: ecommerce-web
|
|
namespace: ecommerce
|
|
labels:
|
|
app: ecommerce-web
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
app: ecommerce-web
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
maxSurge: 1
|
|
maxUnavailable: 0
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: ecommerce-web
|
|
spec:
|
|
containers:
|
|
- name: ecommerce-web
|
|
image: ecommerce-web:latest # <-- replace with your registry image
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- containerPort: 80
|
|
resources:
|
|
requests:
|
|
cpu: "100m"
|
|
memory: "64Mi"
|
|
limits:
|
|
cpu: "250m"
|
|
memory: "128Mi"
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: 80
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
failureThreshold: 3
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: 80
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 15
|
|
failureThreshold: 3
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: ecommerce-web
|
|
namespace: ecommerce
|
|
labels:
|
|
app: ecommerce-web
|
|
spec:
|
|
type: NodePort
|
|
selector:
|
|
app: ecommerce-web
|
|
ports:
|
|
- name: http
|
|
port: 80
|
|
targetPort: 80
|
|
nodePort: 30800 # Access via http://<NODE_IP>:30800
|