minio/minio-dotnet

Client unable to connect to minio K8 Instance, providing no error or logs to debug

Dazing opened this issue · 0 comments

Unable to connect to Minio K8 instance (port forwarded to 9003) or in a application deployed to K8.

6.0.0, 6.0.1: "message=Connection error:The SSL connection could not be established, see inner exception.. Status code=0, response=The SSL connection could not be established, see inner exception., content="

6.0.2: Siliently fails

Neither is helpful.

FYI: Our Loki deployment is succesfully connecting to and using the Minio. Logs are being persisted and is visable in the Minio Console.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework> // Have tried net6.0 as well, no change
    <RootNamespace>minio_client</RootNamespace>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Minio" Version="6.0.2" /> // Tried: 6.0.0, 6.0.1, 6.0.2.  
  </ItemGroup>

</Project>
using Minio;
using Minio.DataModel.Args;

try
{
    var bucketname = "bigbucket-003";
    Console.WriteLine("Creating client..");
    var minio = new MinioClient()
        .WithEndpoint("localhost", 9000)
        .WithCredentials("key", "secret")
        .WithSSL(true)
        .Build();

    Console.WriteLine("BucketExistsAsync..");
    // Make a bucket on the server, if not already present.
    var beArgs = new BucketExistsArgs()
        .WithBucket(bucketname);
    bool found = await minio.BucketExistsAsync(beArgs).ConfigureAwait(false);
    
    Console.WriteLine($"Bucket exists '{found}'..");
    if (!found)
    {
        Console.WriteLine("MakeBucketAsync..");
        var mbArgs = new MakeBucketArgs()
            .WithBucket(bucketname);
        await minio.MakeBucketAsync(mbArgs).ConfigureAwait(false);
    }
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}
Console.ReadLine();

I expect a response of some sort, or least a wait to review logs in Minio console to debug connections.

The dotnet client for Minio is not up to gears with silent failures and quirks like not being able to set client as class property without random errors.