1<section>
2 <h2>K8S private gitlab registry using podman</h2>
3 <p>
4 This is based on <a
5 href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/">Log in to
6 Docker Hub</a>. It is just a bit different to use podman.
7 </p>
8 <p>
9 First we should take a look at podman-login man page:
10<pre><code>man podman login</code></pre>
11 </p>
12 <p>
13 It will give some valueable information like the location of auth.json file. Now we can login using podman:
14<pre><code>podman login registry.gitlab.com</code></pre>
15 </p>
16 <p>Then check the <code>auth.json</code> file located at <code>${XDG_RUNTIME_DIR}/containers/auth.json</code> (as described
17 by the manual). It will contain your auth config:
18<pre><code>{
19 "auths": {
20 "registry.gitlab.com": {
21 "auth": "..."
22 }
23 }
24}</code></pre>
25 </p>
26 <p>
27 Now copy that file over to the server and register it in k8s with the following command:
28<pre><code>
29kubectl create secret generic regcred \
30 --from-file=.dockerconfigjson=auth.json \
31 --type=kubernetes.io/dockerconfigjson</code></pre>
32 </p>
33 <p>
34 Once you have created you can list by kubectl get secret:
35<pre><code>
36NAME TYPE DATA AGE
37regcred kubernetes.io/dockerconfigjson 1 53s</code></pre>
38 </p>
39
40</section>