Go microservices example using Kubernetes
MIT License
This document explains how to run the application using Minikube. Follow the steps below to start Minikube, deploy the necessary services, and manage ingress settings.
kubectl
) installed and configured.Start Minikube by running the following command:
minikube start
This initializes a local Kubernetes cluster using Minikube.
Once Minikube is running, apply the necessary Kubernetes configurations in the following order:
Apply shared configurations and MySQL services:
kubectl apply -f shared-configmap.yaml
kubectl apply -f shared-mysql-statefulset.yaml
kubectl apply -f shared-mysql-service.yaml
Deploy the customer service:
kubectl apply -f customer-deployment.yaml
kubectl apply -f customer-service.yaml
Deploy the catalog service:
kubectl apply -f catalog-deployment.yaml
kubectl apply -f catalog-service.yaml
Deploy the order service:
kubectl apply -f order-deployment.yaml
kubectl apply -f order-service.yaml
Deploy the commerce-gateway service:
kubectl apply -f commerce-gateway-deployment.yaml
kubectl apply -f commerce-gateway-service.yaml
Apply ingress configuration:
kubectl apply -f ingress.yaml
This sets up the necessary deployments, services, and ingress rules for the application.
If your ingress is working correctly, you should be able to access the application via the ingress settings. Check the ingress rules by running:
kubectl get ingress
If the ingress does not work as expected, you can access the services directly using Minikube's service
command. For example, to access the commerce-gateway service, run:
minikube service commerce-gateway-service
This will open the service in your default web browser.
If you're encountering issues with ingress, ensure that the ingress controller is installed and running. You can check the status by running:
kubectl get pods -n ingress-nginx
If not installed, you can install the ingress controller using the following command:
minikube addons enable ingress