gabrielgio.me @ ef0624f48b0a2d6893d28769d46b00bdc5e82987

 1diff --git a/content/logs/2020-12-28-k8s-private-registry.org b/content/logs/2020-12-28-k8s-private-registry.org
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..d3e1b913c85b6a41dc95b3a6490b437b0ec3e70a
 4--- /dev/null
 5+++ b/content/logs/2020-12-28-k8s-private-registry.org
 6@@ -0,0 +1,57 @@
 7+---
 8+title:  "K8S private gitlab registry using podman"
 9+date:   2021-12-28
10+tags: ['kubernetes', 'linux', 'podman', 'gitlab', 'k3s]
11+---
12+
13+This is based on [[https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/][Log in to Docker Hub]].
14+It is just a bit different to use podman
15+
16+First we should take a look at podman-login man page:
17+
18+#+BEGIN_SRC bash
19+man podman login
20+#+END_SRC
21+
22+It will give some valueable information like the location of auth.json file.
23+Now we can login using podman:
24+
25+#+BEGIN_SRC bash
26+podman login registry.gitlab.com
27+#+END_SRC
28+
29+Then check the ~auth.json~ file located at 
30+~${XDG_RUNTIME_DIR}/containers/auth.json~ (as described by the manual).
31+
32+#+BEGIN_SRC bash
33+cat "${XDG_RUNTIME_DIR}/containers/auth.json"
34+#+END_SRC
35+
36+It will print your auth config:
37+
38+#+BEGIN_SRC json
39+{
40+	"auths": {
41+		"registry.gitlab.com": {
42+			"auth": "..."
43+		}
44+	}
45+}
46+#+END_SRC
47+
48+Now copy that file over to the server and register it in k8s with the following command:
49+
50+#+BEGIN_SRC bash
51+kubectl create secret generic regcred \
52+    --from-file=.dockerconfigjson=auth.json \
53+    --type=kubernetes.io/dockerconfigjson
54+#+END_SRC
55+
56+Once you have created you can list by ~kubectl get secret~:
57+
58+#+BEGIN_SRC
59+NAME                                                    TYPE                                  DATA   AGE
60+regcred                                                 kubernetes.io/dockerconfigjson        1      53s
61+#+END_SRC
62+
63+