Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tusmasoma/go-microservice-k8s
Go microservices example using Kubernetes
https://github.com/tusmasoma/go-microservice-k8s
go kubernetes microservice
Last synced: about 1 month ago
JSON representation
Go microservices example using Kubernetes
- Host: GitHub
- URL: https://github.com/tusmasoma/go-microservice-k8s
- Owner: tusmasoma
- License: mit
- Created: 2024-08-17T11:32:20.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-09-18T14:19:41.000Z (2 months ago)
- Last Synced: 2024-09-27T02:24:58.853Z (about 2 months ago)
- Topics: go, kubernetes, microservice
- Language: Go
- Homepage:
- Size: 332 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-microservice-k8s
## How to Run the Application
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.
### Prerequisites
- Minikube installed and set up on your local machine.
- Kubernetes command-line tool (`kubectl`) installed and configured.### Step 1: Start Minikube
Start Minikube by running the following command:
```bash
minikube start
```This initializes a local Kubernetes cluster using Minikube.
### Step 2: Apply Kubernetes Resources
Once Minikube is running, apply the necessary Kubernetes configurations in the following order:
1. **Apply shared configurations and MySQL services**:
```bash
kubectl apply -f shared-configmap.yaml
kubectl apply -f shared-mysql-statefulset.yaml
kubectl apply -f shared-mysql-service.yaml
```2. **Deploy the customer service**:
```bash
kubectl apply -f customer-deployment.yaml
kubectl apply -f customer-service.yaml
```3. **Deploy the catalog service**:
```bash
kubectl apply -f catalog-deployment.yaml
kubectl apply -f catalog-service.yaml
```4. **Deploy the order service**:
```bash
kubectl apply -f order-deployment.yaml
kubectl apply -f order-service.yaml
```5. **Deploy the commerce-gateway service**:
```bash
kubectl apply -f commerce-gateway-deployment.yaml
kubectl apply -f commerce-gateway-service.yaml
```6. **Apply ingress configuration**:
```bash
kubectl apply -f ingress.yaml
```This sets up the necessary deployments, services, and ingress rules for the application.
### Step 3: Access the Application
#### Option 1: Use Ingress
If your ingress is working correctly, you should be able to access the application via the ingress settings. Check the ingress rules by running:
```bash
kubectl get ingress
```#### Option 2: Access Directly via Minikube (If Ingress Fails)
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:
```bash
minikube service commerce-gateway-service
```This will open the service in your default web browser.
#### Troubleshooting Ingress
If you're encountering issues with ingress, ensure that the ingress controller is installed and running. You can check the status by running:
```bash
kubectl get pods -n ingress-nginx
```If not installed, you can install the ingress controller using the following command:
```bash
minikube addons enable ingress
```