# kubernetes-deployment-service.yaml # ---- Deployment ---- # This object defines how to run and manage your application pods. apiVersion: apps/v1 kind: Deployment metadata: name: frontendadmin # Name of the Deployment labels: app: react-app # Label to identify resources related to this app spec: replicas: 1 # Number of desired pods (you can adjust this) selector: matchLabels: app: frontendadmin # This must match the labels in the Pod template template: # Defines the Pod that will be created metadata: labels: app: frontendadmin # Labels applied to each Pod spec: containers: - name: frontendadmin # Name of the container within the Pod image: frontendadmin:latest # <<< IMPORTANT: Replace with your actual image name and tag # Ensure this image is accessible by your Kubernetes cluster. imagePullPolicy: Always # Or "IfNotPresent" if you prefer, especially for "latest" tags ports: - containerPort: 80 # The port your Nginx server is listening on inside the container resources: requests: cpu: "100m" memory: "128Mi" limits: cpu: "200m" memory: "256Mi" --- # ---- Service ---- # This object defines how to access your application. apiVersion: v1 kind: Service metadata: name: frontendadmin-service # Name of the Service labels: app: frontendadmin # Label to identify resources related to this app spec: type: LoadBalancer # Exposes the Service externally using a cloud provider's load balancer. # Alternatives: # - NodePort: Exposes the Service on each Node's IP at a static port. # - ClusterIP: Exposes the Service on a cluster-internal IP (default). # - Ingress: For more advanced HTTP/HTTPS routing (requires an Ingress controller). selector: app: frontendadmin # This must match the labels of the Pods you want to target (from the Deployment) ports: - protocol: TCP port: 3001 # The port the Service will be available on (externally or within the cluster) targetPort: 80 # The port on the Pods (containerPort) that the Service will forward traffic to