macroblog.rs @ ea058a851098bf81cb645249e02d26a8c253db90

 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>
11        <code>man podman login</code>
12    </pre>
13    </p>
14    <p>
15        It will give some valueable information like the location of auth.json file. Now we can login using podman:
16    <pre>
17        <code>podman login registry.gitlab.com</code>
18    </pre>
19    </p>
20    <p>Then check the <i> auth.json </i>file located at <i>${XDG_RUNTIME_DIR}/containers/auth.json</i> (as described
21        by the manual). It will contain your auth config:
22    <pre>
23        <code>
24{
25	"auths": {
26		"registry.gitlab.com": {
27			"auth": "..."
28		}
29	}
30}
31        </code>
32    </pre>
33    </p>
34    <p>
35        Now copy that file over to the server and register it in k8s with the following command:
36    <pre>
37        <code>
38kubectl create secret generic regcred \
39    --from-file=.dockerconfigjson=auth.json \
40    --type=kubernetes.io/dockerconfigjson
41
42        </code>
43    </pre>
44    </p>
45    <p>
46        Once you have created you can list by kubectl get secret:
47    <pre>
48        <code>
49NAME     TYPE                                  DATA   AGE
50regcred  kubernetes.io/dockerconfigjson        1      53s
51        </code>
52    </pre>
53    </p>
54
55</section>