Home > Blockchain >  How to get API Endpoint From EKS Deployment
How to get API Endpoint From EKS Deployment

Time:08-02

I have set up a GraphQL server and deployed successfully on Elastic Kubernetes Service (EKS). How do I get the endpoint to make GraphQL requests? I have been looking around for a couple of hours and cannot seem to find the answer. Shouldn't EKS provide an endpoint for the pods deployed?

CodePudding user response:

As mentioned by Harsh, you will need ingress. but if you just to test this service and need some quick deployment, you can have a service that will create a load balancer for you and keep care of the rest of the thing.

Here is the example, that creates NLB.

apiVersion: v1
kind: Service
metadata:
  name: {{ include "helm-chart.fullname" . }}
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
    service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: "ip"     
    service.beta.kubernetes.io/aws-load-balancer-scheme: "internet-facing"
    service.beta.kubernetes.io/aws-load-balancer-name: "graphql-kubernetes-NLB"
spec:
  type: LoadBalancer
  loadBalancerSourceRanges:
  - "0.0.0.0/0"
  selector:
    app.kubernetes.io/name: {{ include "helm-chart.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
  ports:
    - protocol: TCP
      port: 80
      targetPort: 4000 #graphql service port

Here is the Github enter image description here

enter image description here

CodePudding user response:

Shouldn't EKS provide an endpoint for the pods deployed?

No, that's not the case with that.

Not sure how you have deployed the GraphQl server but you can always expose your application using the service type LoadBalancer.

Which would be easy in your case.

Read more about the service load balancer : https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/

Load balancer service will provide the External IP, that you can use it.

If you don't want to use the LoadBalancer service you have to use the Ingress controller. Using ingress you can expose the API.

Read more about the ingress : https://kubernetes.io/docs/concepts/services-networking/ingress/

  • Related