<p>I have a .NET Core Web API hosted in Kubernetes as a Pod. It is also exposed as a Service.
I have created a Dev SSL certificate and it's produced a aspnetapp.pfx file.</p>
<p>Here is a snippet of my Docker file:</p>
<pre><code>FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 443
ENV ASPNETCORE_URLS=https://+:443
ENV ASPNETCORE_HTTPS_PORT=443
ENV ASPNETCORE_Kestrel__Certificates__Default__Password={password}
ENV ASPNETCORE_Kestrel__Certificates__Default__Path=APIGateway/Certificates/aspnetapp.pfx
</code></pre>
<p>When I run the app in Kubernetes I receive an error in the container logs, and the container is failing to start:</p>
<pre><code>error:2006D002:BIO routines:BIO_new_file:system lib
</code></pre>
<p>I know its able to find the SSL certificate but, its throwing the above error.</p>
<p>Please help!:)</p>

Sach K
<p>I just ran into this same problem and even though things were working fine previously, <em>something</em> was updated (possibly .NET 6.0.402) which caused a problem.</p>
<p>What I noticed is that my exported dev cert pfx in the Docker container had it's permissions set to:</p>
<pre><code>-rw------- 1 root    root    2383 Oct 18 14:40 cert.pfx
</code></pre>
<p>In my Dockerfile, I export the dotnet dev cert and run a chmod to add read permissions for everyone:</p>
<pre><code>RUN dotnet dev-certs https --clean &amp;&amp; dotnet dev-certs https --export-path /app/publish/cert.pfx -p {password}
RUN chmod 644 /app/publish/cert.pfx
</code></pre>
<p>This resulted in permissions which were the same as my appsettings files:</p>
<pre><code>-rw-r--r-- 1 root    root     535 Oct 18 14:11 appsettings.Development.json
-rw-r--r-- 1 root    root     331 Sep 27 18:13 appsettings.json
-rw-r--r-- 1 root    root    2383 Oct 18 14:40 cert.pfx
</code></pre>
<p>That fixed the error for me.</p>
