Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2888

Split-Horizon connection issue from outside Kubernetes

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.10.0
    • Component/s: Connectivity
    • Labels:
      None
    • Environment:
      Kubernetes, external replica set connectivity. ,NET Core

      I have a ReplicaSet deployed with MongoDB Operator to Kubernetes and configured with Split-Horizon as follows:

      security:
        tls:
          enabled: true
        authentication:
          enabled: true
          modes: ["SCRAM"]
      
      connectivity:
        replicaSetHorizons:
          - "horizon-1": "node-2:31502"
      

      I can connect to it from shell in a following connection way:

      mongo mongodb://admin:admin-password@node-2:31502/admin?replicaSet=mongo-local-0 --tls --tlsAllowInvalidCertificates
      

      From C# I am trying following:

      var settings = MongoClientSettings.FromConnectionString("mongodb://admin:admin-password@node-2:31502/admin");
      settings.UseTls = true;
      settings.AllowInsecureTls = true;
      settings.ReplicaSetName = "mongo-local-0";
      
      var cursor = await new MongoClient(settings).ListDatabasesAsync();
      await cursor.MoveNextAsync();
      
      cursor.Current.Should().NotBeEmpty();
      

      But it fails with connection timeout exception:

      System.TimeoutException : A timeout occured after 30000ms selecting a server using CompositeServerSelector\{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is \{ ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [] }.
       at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
       at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
       at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedAsync(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
       at MongoDB.Driver.Core.Clusters.Cluster.SelectServerAsync(IServerSelector selector, CancellationToken cancellationToken)
       at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterSeverSelctionAsync(CancellationToken cancellationToken)
       at MongoDB.Driver.MongoClient.AreSessionsSupportedAsync(CancellationToken cancellationToken)
       at MongoDB.Driver.MongoClient.StartImplicitSessionAsync(CancellationToken cancellationToken)
       at MongoDB.Driver.MongoClient.UsingImplicitSessionAsync[TResult](Func`2 funcAsync, CancellationToken cancellationToken)
      

      If I comment-out replica set line connection works, but then I am not connected to a replica set, but to a single node.

      Am I missing something or is it not yet supported? Is there a workaround?

       

            Assignee:
            dmitry.lukyanov@mongodb.com Dmitry Lukyanov (Inactive)
            Reporter:
            andrii.litvinov@gmail.com Andrii Litvinov
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: