<p>getting</p>
<pre><code>INFO AmazonHttpClient: Unable to execute HTTP request: Connection refused (Connection refused)
java.net.ConnectException: Connection refused (Connection refused)
</code></pre>
<p>when trying to read data from minIO via spark. I am running my spark jar via spark operator on Kubernetes on WSL2 + Docker Desktop. MinIO is also run on Kubernetes in a separate namespace.</p>
<p>my spark context settings:</p>
<pre><code>val s3endPointLoc = &quot;http://127.0.0.1:9000&quot;
spark.sparkContext.hadoopConfiguration.set(&quot;fs.s3a.endpoint&quot;, s3endPointLoc)
spark.sparkContext.hadoopConfiguration.set(&quot;fs.s3a.access.key&quot;, s3accessKeyAws)
spark.sparkContext.hadoopConfiguration.set(&quot;fs.s3a.secret.key&quot;, s3secretKeyAws)
spark.sparkContext.hadoopConfiguration.set(&quot;fs.s3a.connection.timeout&quot;, connectionTimeOut)
spark.sparkContext.hadoopConfiguration.set(&quot;spark.sql.debug.maxToStringFields&quot;, &quot;100&quot;)
spark.sparkContext.hadoopConfiguration.set(&quot;fs.s3a.path.style.access&quot;, &quot;true&quot;)
spark.sparkContext.hadoopConfiguration.set(&quot;fs.s3a.impl&quot;, &quot;org.apache.hadoop.fs.s3a.S3AFileSystem&quot;)
spark.sparkContext.hadoopConfiguration.set(&quot;fs.s3a.connection.ssl.enabled&quot;, &quot;true&quot;)
</code></pre>
<p>What might be the reason for the refused connection? thanks</p>

Tomáš Sedloň
<p>You cannot simply connect via <code>http://127.0.0.1:9000</code></p>
<p>You should provide the MinIO service DNS name to Spark: <code>&lt;MinIO-ServiceName&gt;.&lt;MinIO-Namespace&gt;.svc.cluster.local:9000</code></p>
