From 29d36332c35498d27824c74c96f083a67a74297c Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Tue, 6 Aug 2024 15:05:05 +0200 Subject: [PATCH] =?UTF-8?q?Creaci=C3=B3n=20del=20registry=20local?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NginxConf202311/README.md | 2 +- PGO/creaTodo.sh | 10 +--- PGO/paraTodo.sh | 9 +-- PGO/pv-local-pg.yaml | 2 +- mypdr/README.md | 7 +++ mypdr/creaTodo.sh | 5 ++ mypdr/inspeccionarSecret.sh | 1 + mypdr/paraTodo.sh | 5 ++ mypdr/pv-local-registry.yaml | 28 +++++++++ mypdr/reg-secret.yaml | 8 +++ ...registry-claim0-persistentvolumeclaim.yaml | 14 +++++ ...registry-claim1-persistentvolumeclaim.yaml | 14 +++++ mypdr/registry-deployment.yaml | 59 +++++++++++++++++++ mypdr/registry-service.yaml | 21 +++++++ mypdr/registry.password | 1 + 15 files changed, 167 insertions(+), 19 deletions(-) create mode 100644 mypdr/README.md create mode 100644 mypdr/creaTodo.sh create mode 100644 mypdr/inspeccionarSecret.sh create mode 100644 mypdr/paraTodo.sh create mode 100644 mypdr/pv-local-registry.yaml create mode 100644 mypdr/reg-secret.yaml create mode 100644 mypdr/registry-claim0-persistentvolumeclaim.yaml create mode 100644 mypdr/registry-claim1-persistentvolumeclaim.yaml create mode 100644 mypdr/registry-deployment.yaml create mode 100644 mypdr/registry-service.yaml create mode 100644 mypdr/registry.password diff --git a/NginxConf202311/README.md b/NginxConf202311/README.md index 2b6aa534..9c57e23c 100644 --- a/NginxConf202311/README.md +++ b/NginxConf202311/README.md @@ -10,7 +10,7 @@ En es mismo fichero hay que poner el puerto **NodePort** que tiene asociado nues Se guarda el fichero y se crea un enlace simbólico en **/etc/nginx/sites-enabled** - ln -s /etc/nginx/sites-available/calibre.conf /etc/nginx/sites-enable + ln -s /etc/nginx/sites-available/calibre.conf /etc/nginx/sites-enabled y se reinicia nginx diff --git a/PGO/creaTodo.sh b/PGO/creaTodo.sh index 4f0771b8..81740413 100755 --- a/PGO/creaTodo.sh +++ b/PGO/creaTodo.sh @@ -1,15 +1,7 @@ +kubectl create namespace postgres kubectl create -f pv-local-pg.yaml kubectl create -f pvc-pg.yaml kubectl create -f postgres-configmap.yaml kubectl create -f postgres-deployment.yaml kubectl create -f postgres-service.yaml -# pgadmin -#kubectl create -f pv-local-pgadmin.yaml -#kubectl create -f pvc-pgadmin.yaml -#kubectl create -f pgadmin-secret.yaml -#kubectl create -f pgadmin-service.yaml -#kubectl create -f pgadmin-deployment.yaml -#kubectl create -f pgadmin-configmap.yaml -kubectl create -f pv-local-phppgadmin.yaml -kubectl create -f phppgadmin-deployment.yaml watch kubectl get all -n postgres diff --git a/PGO/paraTodo.sh b/PGO/paraTodo.sh index ed19ce5f..719b1524 100755 --- a/PGO/paraTodo.sh +++ b/PGO/paraTodo.sh @@ -3,11 +3,4 @@ kubectl delete -f postgres-deployment.yaml kubectl delete -f postgres-configmap.yaml kubectl delete -f pvc-pg.yaml kubectl delete -f pv-local-pg.yaml -#kubectl delete -f pgadmin-configmap.yaml -#kubectl delete -f pgadmin-secret.yaml -#kubectl delete -f pgadmin-service.yaml -#kubectl delete -f pgadmin-deployment.yaml -#kubectl delete -f pvc-pgadmin.yaml -#kubectl delete -f pv-local-pgadmin.yaml -kubectl delete -f phppgadmin-deployment.yaml -kubectl delete -f pv-local-phppgadmin.yaml +kubectl delete ns postgres diff --git a/PGO/pv-local-pg.yaml b/PGO/pv-local-pg.yaml index 9009b42d..385a8d87 100644 --- a/PGO/pv-local-pg.yaml +++ b/PGO/pv-local-pg.yaml @@ -8,4 +8,4 @@ spec: accessModes: - ReadWriteOnce hostPath: - path: "/mnt/cluster/postgres/postgres-db" + path: "/mnt/Externo/postgres/postgres-db" diff --git a/mypdr/README.md b/mypdr/README.md new file mode 100644 index 00000000..091e6a8c --- /dev/null +++ b/mypdr/README.md @@ -0,0 +1,7 @@ +# instruciones para levantar el registry + +https://gcore.com/learning/4-easy-steps-to-set-up-a-private-docker-registry-on-ubuntu/ + +# instrucciones para crear el Secret y usarlo en los pods + +https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ diff --git a/mypdr/creaTodo.sh b/mypdr/creaTodo.sh new file mode 100644 index 00000000..d775d8f7 --- /dev/null +++ b/mypdr/creaTodo.sh @@ -0,0 +1,5 @@ +kubectl create -f pv-local-registry.yaml +kubectl create -f registry-claim0-persistentvolumeclaim.yaml +kubectl create -f registry-claim1-persistentvolumeclaim.yaml +kubectl create -f registry-deployment.yaml +kubectl create -f registry-service.yaml diff --git a/mypdr/inspeccionarSecret.sh b/mypdr/inspeccionarSecret.sh new file mode 100644 index 00000000..d376abb2 --- /dev/null +++ b/mypdr/inspeccionarSecret.sh @@ -0,0 +1 @@ +kubectl get secret myregistrykey --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode diff --git a/mypdr/paraTodo.sh b/mypdr/paraTodo.sh new file mode 100644 index 00000000..a7d6e8f8 --- /dev/null +++ b/mypdr/paraTodo.sh @@ -0,0 +1,5 @@ +kubectl delete -f registry-service.yaml +kubectl delete -f registry-deployment.yaml +kubectl delete -f registry-claim1-persistentvolumeclaim.yaml +kubectl delete -f registry-claim0-persistentvolumeclaim.yaml +kubectl delete -f pv-local-registry.yaml diff --git a/mypdr/pv-local-registry.yaml b/mypdr/pv-local-registry.yaml new file mode 100644 index 00000000..73cc84ef --- /dev/null +++ b/mypdr/pv-local-registry.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: mypdr-main-folder + labels: + app: mypdr +spec: + capacity: + storage: 100Mi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/Externo/mypdr/main" +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: mypdr-a2auth-folder + labels: + app: mypdr +spec: + capacity: + storage: 10Mi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/Externo/mypdr/a2auth" + diff --git a/mypdr/reg-secret.yaml b/mypdr/reg-secret.yaml new file mode 100644 index 00000000..d3bb1442 --- /dev/null +++ b/mypdr/reg-secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: myregistrykey + # namespace: awesomeapps +data: + .dockerconfigjson: ewoJImF1dGhzIjogewoJCSJyZWdpc3RyeS5yZXltb3RhLmVzIjogewoJCQkiYXV0aCI6ICJZM0psZVd4dmNHVjZPbEpsZVMweE1UYzIiCgkJfQoJfQp9 +type: kubernetes.io/dockerconfigjson diff --git a/mypdr/registry-claim0-persistentvolumeclaim.yaml b/mypdr/registry-claim0-persistentvolumeclaim.yaml new file mode 100644 index 00000000..fea9554e --- /dev/null +++ b/mypdr/registry-claim0-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: registry-claim0 + name: registry-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/mypdr/registry-claim1-persistentvolumeclaim.yaml b/mypdr/registry-claim1-persistentvolumeclaim.yaml new file mode 100644 index 00000000..48acdf26 --- /dev/null +++ b/mypdr/registry-claim1-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: registry-claim1 + name: registry-claim1 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Mi +status: {} diff --git a/mypdr/registry-deployment.yaml b/mypdr/registry-deployment.yaml new file mode 100644 index 00000000..64a3f8a9 --- /dev/null +++ b/mypdr/registry-deployment.yaml @@ -0,0 +1,59 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.26.0 (40646f47) + creationTimestamp: null + labels: + io.kompose.service: registry + name: registry +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: registry + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.26.0 (40646f47) + creationTimestamp: null + labels: + io.kompose.service: registry + spec: + containers: + - env: + - name: REGISTRY_AUTH + value: htpasswd + - name: REGISTRY_AUTH_HTPASSWD_PATH + value: /a2auth/registry.password + - name: REGISTRY_AUTH_HTPASSWD_REALM + value: Registry + - name: REGISTRY_HTTP_SECRET + value: SomeRandomStringToUse + - name: REGISTRY_STORAGE_DELETE_ENABLED + value: ‘true’ + - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY + value: /main + image: registry:2 + name: registry + ports: + - containerPort: 5000 + resources: {} + volumeMounts: + - mountPath: /main + name: registry-claim0 + - mountPath: /a2auth + name: registry-claim1 + restartPolicy: Always + volumes: + - name: registry-claim0 + persistentVolumeClaim: + claimName: registry-claim0 + - name: registry-claim1 + persistentVolumeClaim: + claimName: registry-claim1 +status: {} diff --git a/mypdr/registry-service.yaml b/mypdr/registry-service.yaml new file mode 100644 index 00000000..7c2897d0 --- /dev/null +++ b/mypdr/registry-service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.26.0 (40646f47) + creationTimestamp: null + labels: + io.kompose.service: registry + name: registry +spec: + type: NodePort + ports: + - name: "5010" + port: 5010 + nodePort: 30342 + targetPort: 5000 + selector: + io.kompose.service: registry +status: + loadBalancer: {} diff --git a/mypdr/registry.password b/mypdr/registry.password new file mode 100644 index 00000000..fd11cbb6 --- /dev/null +++ b/mypdr/registry.password @@ -0,0 +1 @@ +creylopez:$2y$05$WhvZdhVr.Xwz.j/M61fMTu2ea8yAf5bPjPvQadT12kuzZaJw2Gwri