(01)Build and load images
Linux
1# Build Spring JARs, then Docker images2docker build -t spring-api-a:local ./service-a3docker build -t spring-api-b:local ./service-b4minikube image load spring-api-a:local5minikube image load spring-api-b:localTwo Spring Boot services with Deployments, ClusterIP Services, and resource limits
service-a-deployment.yml
1apiVersion: apps/v12kind: Deployment3metadata:4 name: service-a5spec:6 replicas: 17 selector:8 matchLabels:9 app: service-a10 template:11 metadata:12 labels:13 app: service-a14 spec:15 containers:16 - name: service-a17 image: spring-api-a:local18 imagePullPolicy: IfNotPresent19 ports:20 - containerPort: 808021 resources:22 requests:23 memory: "256Mi"24 cpu: "250m"25 limits:26 memory: "512Mi"27 cpu: "500m"service-a-svc.yml
1apiVersion: v12kind: Service3metadata:4 name: service-a5spec:6 type: ClusterIP7 selector:8 app: service-a9 ports:10 - port: 808011 targetPort: 8080service-b-deployment.yml
1apiVersion: apps/v12kind: Deployment3metadata:4 name: service-b5spec:6 replicas: 17 selector:8 matchLabels:9 app: service-b10 template:11 metadata:12 labels:13 app: service-b14 spec:15 containers:16 - name: service-b17 image: spring-api-b:local18 imagePullPolicy: IfNotPresent19 ports:20 - containerPort: 808021 env:22 - name: SERVICE_A_URL23 value: "http://service-a:8080"24 resources:25 requests:26 memory: "256Mi"27 cpu: "250m"28 limits:29 memory: "512Mi"30 cpu: "500m"service-b-svc.yml
1apiVersion: v12kind: Service3metadata:4 name: service-b5spec:6 type: NodePort7 selector:8 app: service-b9 ports:10 - port: 808011 targetPort: 808012 nodePort: 32080Step 01
1# Build Spring JARs, then Docker images2docker build -t spring-api-a:local ./service-a3docker build -t spring-api-b:local ./service-b4minikube image load spring-api-a:local5minikube image load spring-api-b:local1kubectl apply -f service-a-deployment.yml2kubectl apply -f service-a-svc.yml3kubectl apply -f service-b-deployment.yml4kubectl apply -f service-b-svc.yml5kubectl get pods,svc