Home > Software design >  .Net application cant connect to RabbitMQ on minikube
.Net application cant connect to RabbitMQ on minikube

Time:09-24

I'm trying to connect my .Net application pod to the RabbitMQ pod that I have running inside minikube. I have tried with all types of services, since it did not work I tried directly connecting the pods with their ip addresses within the pod. Even then the application pod is unable to connect to the RabbitMQ pod.

This is the error I'm getting

[05:40:31 INF] RabbitMQ Client is trying to connect
[05:40:39 WRN] RabbitMQ Client could not connect after 2.0s (None of the specified endpoints were reachable)
RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable
 ---> System.AggregateException: One or more errors occurred. (Connection failed)
 ---> RabbitMQ.Client.Exceptions.ConnectFailureException: Connection failed
 ---> System.Net.Internals.SocketExceptionFactory ExtendedSocketException (00000001, 11): Resource temporarily unavailable
   at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses)
   at System.Net.Dns.<>c.b__27_2(Object s)
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)

Although I am able to log into the rabbitmq management dashboard through when I'm using a nordport service.

heres my pod spec

spec:
  containers:
    - name: rabbitmq
      image: rabbitmq:3-management-alpine
      # image name : tag
      ports:
        - containerPort: 5672
          name: amqp
        - containerPort: 15672
          name: http
      env:
        - name: RABBITMQ_DEFAULT_VHOST
          value: /
        - name: RABBITMQ_DEFAULT_USER
          value: dev
        - name: RABBITMQ_DEFAULT_PASS
          value: dev     

EDIT I have added my service file here

apiVersion: v1
kind: Service
metadata:
  name: rabbitmq-service
  labels:
    name: rabbitmq-service
    app: myapp
spec:
  type: ClusterIP
  clusterIP: None
  ports:
    - name: amqp
      protocol: TCP
      port: 5672
  selector:
    name: rabbitmq-pod
    app: myapp

CodePudding user response:

The issue was with the appsettings.json; Eventhough I was submitting the connections strings in my config map into the appsettings.json the application was taking the configurations from the apsetting.Development.json.

  • Related