MiniKube
Kubernetes must be installed and running on your local machine. You can use Minikube or Kind for this purpose. If you are using Docker Desktop, make sure Kubernetes is enabled in the settings.
The concepts and the Postgres and Gateway manifests are covered in Hands-on 5 β Orchestration.
TO DO
All microservices should be published in the same kubernetes cluster. Create a setup file for each microservice, in its own k8s folder, eg.:
Where k8s.yaml is the setup file for the microservice. The setup file should include the following resources:
Secrets;ConfigMap;Deployment, and;Service.
Every microservice must have its own setup file:
account-service;auth-service;gateway-service;product-service, and;order-service.
Run all services in the same cluster and verify they are healthy. You may use a local Kubernetes setup or a cloud provider such as AWS, Azure, or Google Cloud Platform. Demonstrate that all services are running in the same cluster by recording a short video.
Example: account-service
A single k8s.yaml can hold several resources, separated by ---. The account service reads its database connection from the ConfigMap (host, port, database) and the Secret (username, password), and connects to the postgres Service from Hands-on 5.
Only the gateway is exposed outside the cluster (type: LoadBalancer); the other services use type: ClusterIP and are reached by the gateway through their Service name (e.g. http://account:8080).
Minikube
- Images: the cluster must be able to pull your images. Push them to Docker Hub, or load a local image with
minikube image load <image>and keepimagePullPolicy: IfNotPresent(withAlways, Kubernetes tries the registry and fails). - Gateway access: a
LoadBalancerService stays<pending>on Minikube. Runminikube tunnelin another terminal, or open it withminikube service gateway.