Skip to content

Golang microservices architecture POC deployed on Kubernetes, including an API gateway implemented using Ingress and docker for containerization.

Notifications You must be signed in to change notification settings

Ethical-Ralph/go-k8s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang k8s

A Golang project that can be deployed on Kubernetes using Minikube. this project includes three services and an API gateway implemented with Ingress. This readme file provides instructions on how to set up and run the project on Minikube, including configuring the /etc/hosts file to access the API gateway.

Prerequisites

Before running the project, make sure you have the following dependencies installed:

  • Go programming language
  • Docker
  • Minikube

Getting Started

To set up and run the project on Minikube, follow the steps below:

  1. Start Minikube by running the following command:

    minikube start
    
  2. Set up the Docker environment in the Minikube session using the following command:

    eval $(minikube docker-env)
    
  3. Build the Docker containers for each service by navigating to their respective directories and running the following commands:

    • For auth-service:
      cd auth-service
      docker build -t ethical/auth-api .
      
    • For hello-service:
      cd hello-service
      docker build -t ethical/hello-api .
      
    • For dummy-service:
      cd dummy-service
      docker build -t ethical/dummy-api .
      
  4. Apply the Kubernetes manifest to create the services, deployments, and ingress by running the following command:

    kubectl apply -f ./manifest
    
  5. Configure the /etc/hosts file to map the hostname used by the API gateway to the Minikube IP. Open the /etc/hosts file using a text editor (you may need administrator/root privileges) and add the following line:

    <minikube-ip> go-gateway.app
    

    Replace <minikube-ip> with the IP address of your Minikube cluster. You can get the IP address by running the command minikube ip.

  6. Access the API gateway and services by opening a web browser and navigating to http://go-gateway.app. You should be able to access the following paths:

    • /login - Auth service
    • /hello - Hello service
    • /dummy - Dummy service
  • If you are unable to access the services in the browser, you can use the following command to make a curl request from within the Minikube environment:

    minikube ssh -- curl http://go-gateway.app
    

    This command will SSH into the Minikube cluster and then make a curl request to the API gateway.

Cleaning Up

To clean up the resources created by the project, run the following command:

kubectl delete -f ./manifest

This will delete all services, deployments, and ingress created for this project.

Additional Information

Feel free to reach out if you have any questions or encounter any issues.

About

Golang microservices architecture POC deployed on Kubernetes, including an API gateway implemented using Ingress and docker for containerization.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published