diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml new file mode 100644 index 0000000..a216fc0 --- /dev/null +++ b/k8s/deployment.yaml @@ -0,0 +1,21 @@ +# Runs one Pod of the glassboxml-webapp image and keeps it running. +apiVersion: apps/v1 # API group/version that defines the Deployment resource +kind: Deployment # Resource type: manages a set of identical Pods +metadata: + name: glassboxml-webapp # Name of this Deployment object +spec: + replicas: 1 # Run a single Pod (no redundancy/scaling needed locally) + selector: + matchLabels: + app: glassboxml-webapp # Tells the Deployment which Pods it owns/manages + template: # Pod template used to create each replica + metadata: + labels: + app: glassboxml-webapp # Must match spec.selector.matchLabels above + spec: + containers: + - name: glassboxml-webapp # Name of the container within the Pod + image: glassboxml-webapp # Image built locally via `docker build -t glassboxml-webapp .` + imagePullPolicy: Never # Never pull from a registry — use the image already present in minikube's Docker daemon + ports: + - containerPort: 8000 # Port the FastAPI/uvicorn server listens on inside the container diff --git a/k8s/service.yaml b/k8s/service.yaml new file mode 100644 index 0000000..907fb1c --- /dev/null +++ b/k8s/service.yaml @@ -0,0 +1,12 @@ +# Exposes the glassboxml-webapp Pod so it can be reached from outside the cluster. +apiVersion: v1 # Core API group/version that defines the Service resource +kind: Service # Resource type: stable network endpoint in front of Pods +metadata: + name: glassboxml-webapp # Name of this Service object +spec: + type: NodePort # Exposes the Service on a static port on the minikube node itself + selector: + app: glassboxml-webapp # Routes traffic to Pods with this label (must match the Deployment's Pod labels) + ports: + - port: 8000 # Port the Service listens on inside the cluster + targetPort: 8000 # Port on the Pod to forward traffic to (matches containerPort)