Unable to Access NodePort Service in Browser Despite Successful curl

I am running a Kubernetes NodePort service on port 31111. When I use curl to test it I receive the expected HTML response from the application. However, when I try to access the same URL in the browser I cannot see the application. It does not load, and the browser eventually times out.

Environment:

  • Ubuntu Ec2 instance
  • Kubernetes on Minikube
  • NodePort service YAML:
apiVersion: v1
kind: Service
metadata:
  name: webapp-service
spec:
  type: NodePort
  selector:
    app: webapp
  ports:
    - protocol: TCP
      port: 3000
      targetPort: 3000
      nodePort: 31111

Application inside the container is listening on :::3000 as confirmed by netstat.

Questions:

  • Why does curl work while the browser cannot connect?
  • Is there a firewall or browser-specific configuration I need to adjust?
  • How can I ensure the browser can access the service?