<p>I'm running a docker private registry inside a <em>kubernetes</em> cluster using the standard <code>registry:2</code> image. The image has basic functionality to provide user authentication using the Apache htpasswd utility.
In my case multiple users need to access the repository and therefore need to setup username passwords for multiple different users. What would be the best approach to implement this.</p>

<p>I got the single user htpsswd based authentication working, but does not seem to find a way to enable auth for multiple users i.e. having proper access control.</p>

<p>The registry is SSL enabled.(TLS at the ingress level)</p>

<p>There are multiple ways this could be done. First of all its possible to have multiple users in the htpasswd file. It was not working with docker becasue docker required the passwords to be hashed using bcrypt algorithm.</p>

<p>Use the <code>-B</code> flag while creating the htpasswd file.</p>

<pre><code>sudo htpasswd -c -B /etc/apache2/.htpasswd &lt;username1&gt;
</code></pre>

<p>Another way this could be done, is using nginx authentication annotations.</p>

<p><code>nginx.ingress.kubernetes.io/auth-url: "url to auth service"</code></p>

<p>If the service return 200, nginx forwards the request or else returns authentication error response. With this you could have a lot of custom logic as you create and manage the authentication server.</p>
