Search code examples
javadockerkubernetesspring-cloud

Should I deploy api-gateway on GKE engine?


I am working on a demo project , which has 5 microservices - discovery server , api-gateway , user-order-detail , order and user service.

I will expose the order and user service internally

I will expose the user-order-detail service externally which will call the other two services using a rest endpoint.

1) Should I deploy discovery server and api gateway on kubernetes engine and if not how will the routing be handled ?

If I do not deploy the api-gateway , how will this rest call take place ?

enter image description here

2) Also as there is a application.properties file in every spring-cloud project. Does docker image replace the application.properties file ?

3) I am using docker and kubernetes for the first time.Can someone explain what should be my next step after creating the docker images for my services ? (just the steps , I will figure out how to complete those steps)

UPDATE:

Services that are up:

user-order-detail LoadBalancer
kubernetes ClusterIP
order-management LoadBalancer
user-management LoadBalancer

user-order-detail hits an endpoint to retrieve all users. I am getting this error :No matches for the virtual host name :user-management


Solution

  • Please find the answers below:-

    1) Yes, you can deploy discovery service and api-gateway on kubernetes engine and please go through this document in regards which type of service you will expose.

    Services:- https://kubernetes.io/docs/concepts/services-networking/service/

    2) You can copy the application.properties file while building the image or if you want to override at the run time. Please create a configMap in Kubernetes and inject into the Kubernetes pod by volume. Please follow below links on ConfigMap.

    https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#add-configmap-data-to-a-volume

    https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#add-configmap-data-to-a-volume

    3) Steps to do after creating images:-

    1. Push the image to registry
    2. Deploy the pod on kubernetes
    3. Create a service to expose the pod