From 2d1b25e40eb01e6201ef67f4f8e01c55cddfe160 Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Mon, 21 Jul 2025 13:54:13 +0200 Subject: [PATCH] k8s initialize --- doc/k8s-testing.md | 69 ++++++++++++++++++++++ kube/01-initialize/01-namespace.yaml | 6 ++ kube/01-initialize/02-registry-secret.yaml | 11 ++++ 3 files changed, 86 insertions(+) create mode 100644 doc/k8s-testing.md create mode 100644 kube/01-initialize/01-namespace.yaml create mode 100644 kube/01-initialize/02-registry-secret.yaml diff --git a/doc/k8s-testing.md b/doc/k8s-testing.md new file mode 100644 index 0000000..ee7b367 --- /dev/null +++ b/doc/k8s-testing.md @@ -0,0 +1,69 @@ +# Hlæja K8s + +## Table of Contents + + +* [Hlæja K8s](#hlæja-k8s) + * [Table of Contents](#table-of-contents) + * [Initialize](#initialize) + * [Namespace](#namespace) + * [Registry Secret](#registry-secret) + + +---- + +## Initialize + +### Namespace + +Create the Namespace for the environment. + +```bash +kubectl apply -f .\kube\01-initialize\01-namespace.yaml +``` + +--- + +### Registry Secret + +Create repository secret + +```bash +kubectl apply -f .\kube\01-initialize\02-registry-secret.yaml +``` + +**How to make JSON Configuration** + +```json= +{ + "auths": { + "": { + "username": "", + "password": "", + "email": "", + "auth": "" + } + } +} +``` + +**Replace Values** + +- **Replace** : Use the hostname of your Gitea instance (e.g., registry.example.com). +- **Replace** : Use your Gitea username (e.g., user1). +- **Replace** : Use your Gitea personal access token generated with read:package scope (e.g., abc123). +- **Replace** : Use your email address (e.g., user1@example.com). + +**Linux Command** + +```bash +echo -n 'your-username:your-password' | base64 -w 0 +``` + +witch gives `eW91ci11c2VybmFtZTp5b3VyLXBhc3N3b3Jk` then we use it in the `auth` + +```bash +echo -n '{"auths":{"":{"username":"your-username","password":"your-password","email":"your-email","auth":"eW91ci11c2VybmFtZTp5b3VyLXBhc3N3b3Jk"}}}' | base64 -w 0 +``` + +witch give `eyJhdXRocyI6eyI8eW91ci1yZWdpc3RyeT4iOnsidXNlcm5hbWUiOiJ5b3VyLXVzZXJuYW1lIiwicGFzc3dvcmQiOiJ5b3VyLXBhc3N3b3JkIiwiZW1haWwiOiJ5b3VyLWVtYWlsIiwiYXV0aCI6ImVXOTFjaTExYzJWeWJtRnRaVHA1YjNWeUxYQmhjM04zYjNKayJ9fX0=` diff --git a/kube/01-initialize/01-namespace.yaml b/kube/01-initialize/01-namespace.yaml new file mode 100644 index 0000000..8554e89 --- /dev/null +++ b/kube/01-initialize/01-namespace.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: hlaeja + labels: + environment: testing diff --git a/kube/01-initialize/02-registry-secret.yaml b/kube/01-initialize/02-registry-secret.yaml new file mode 100644 index 0000000..54223c1 --- /dev/null +++ b/kube/01-initialize/02-registry-secret.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Secret +metadata: + name: github + namespace: hlaeja + labels: + environment: testing +type: kubernetes.io/dockerconfigjson +data: + # Look at /doc/k8s.md at Initialize -> Registry Secret, for how to make real values + .dockerconfigjson: RegisterSecretBase64==