(01)Build and load images
Linux
1docker build -t node-gateway:local ./gateway2docker build -t node-worker:local ./worker3minikube image load node-gateway:local4minikube image load node-worker:localNode API gateway + worker Deployments with ConfigMap env and internal service DNS
configmap.yml
1apiVersion: v12kind: ConfigMap3metadata:4 name: node-api-config5data:6 NODE_ENV: "production"7 WORKER_URL: "http://worker-svc:4000"gateway-deployment.yml
1apiVersion: apps/v12kind: Deployment3metadata:4 name: gateway5spec:6 replicas: 27 selector:8 matchLabels:9 app: gateway10 template:11 metadata:12 labels:13 app: gateway14 spec:15 containers:16 - name: gateway17 image: node-gateway:local18 imagePullPolicy: IfNotPresent19 ports:20 - containerPort: 300021 envFrom:22 - configMapRef:23 name: node-api-config24 resources:25 requests:26 memory: "128Mi"27 cpu: "100m"28 limits:29 memory: "256Mi"30 cpu: "250m"gateway-svc.yml
1apiVersion: v12kind: Service3metadata:4 name: gateway-svc5spec:6 type: NodePort7 selector:8 app: gateway9 ports:10 - port: 300011 targetPort: 300012 nodePort: 32300worker-deployment.yml
1apiVersion: apps/v12kind: Deployment3metadata:4 name: worker5spec:6 replicas: 17 selector:8 matchLabels:9 app: worker10 template:11 metadata:12 labels:13 app: worker14 spec:15 containers:16 - name: worker17 image: node-worker:local18 imagePullPolicy: IfNotPresent19 ports:20 - containerPort: 400021 resources:22 requests:23 memory: "128Mi"24 cpu: "100m"worker-svc.yml
1apiVersion: v12kind: Service3metadata:4 name: worker-svc5spec:6 type: ClusterIP7 selector:8 app: worker9 ports:10 - port: 400011 targetPort: 4000Step 01
1docker build -t node-gateway:local ./gateway2docker build -t node-worker:local ./worker3minikube image load node-gateway:local4minikube image load node-worker:local1kubectl apply -f configmap.yml2kubectl apply -f gateway-deployment.yml3kubectl apply -f gateway-svc.yml4kubectl apply -f worker-deployment.yml5kubectl apply -f worker-svc.yml6kubectl get pods,svc