Deployment and Service
A Deployment describes how to run the pod and how many copies to keep alive. A Service gives that group of pods a stable virtual IP inside the cluster. Together they are the minimum viable production shape.
apiVersion: apps/v1
kind: Deployment
metadata:
name: enterprise-rag
labels:
app: enterprise-rag
spec:
replicas: 2
selector:
matchLabels:
app: enterprise-rag
template:
metadata:
labels:
app: enterprise-rag
spec:
containers:
- name: api
image: enterprise-rag-kubernetes-ray:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8000
envFrom:
- configMapRef:
name: enterprise-rag-config
- secretRef:
name: enterprise-rag-secrets
resources:
requests:
cpu: '250m'
memory: '512Mi'
limits:
cpu: '1000m'
memory: '2Gi'
volumeMounts:
- name: chroma-data
mountPath: /data/chroma
volumes:
- name: chroma-data
emptyDir: {}Requests reserve capacity for the scheduler. Limits cap runtime use. The embedding model plus ChromaDB comfortably fits in 512 Mi at baseline and can burst to 2 Gi during large ingests. The envFrom block points at a ConfigMap and a Secret you create when we split config from secrets; for now, read it as where the container env comes from.
apiVersion: v1
kind: Service
metadata:
name: enterprise-rag
labels:
app: enterprise-rag
spec:
type: ClusterIP
selector:
app: enterprise-rag
ports:
- name: http
port: 80
targetPort: 8000
protocol: TCPClusterIP is the default: reachable inside the cluster only. The Service forwards port 80 traffic to port 8000 on any pod matching app=enterprise-rag. Ingress will add external access next.
Quiz: Quiz
Loading practice…