Search code examples
spring-bootrestkuberneteseconnreset

Getting "read ECONNRESET" error for every Restfull Webservice calls


I've got a spring boot application deployed successfully on Kubernetes. But, whenever I make a webservice call from Postman I receive "read ECONNRESET" error. My kubernetes pod and service are all up and running. I couldn't figure out the cause of the problem. Any help is appreciated.


Solution

  • For further explanation:

    My service was exposing 8081 port as below:

    apiVersion: v1
    kind: Service
    metadata:
      name: service-restapi
      namespace: restapi-k8s
      labels:
         app: restapi
    spec:
      selector:
        app: restapi
      type: LoadBalancer
      ports:
        - protocol: TCP
          port: 8081
          targetPort: 8081
          nodePort: 32588
    

    And my springboot application was running on port 8080. I've changed the server port of the application by adding the line below to my application.propereties file. Now problem is solved, my restfull web service is responding the requests from the port 8081.

    server.port=8081