From ca23d0227514765c56e985fbd958d9adc5b1567a Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Wed, 9 Oct 2024 11:13:47 +0000 Subject: [PATCH] Creo yaml de registry local --- JugarAlPadel/K8S/Makefile.local | 2 +- Registry/Makefile | 12 ++++++ Registry/namespace.yaml | 7 ++++ Registry/pv-local-registry.yaml | 14 +++++++ Registry/registry-deployment.yaml | 69 +++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 Registry/Makefile create mode 100644 Registry/namespace.yaml create mode 100644 Registry/pv-local-registry.yaml create mode 100644 Registry/registry-deployment.yaml diff --git a/JugarAlPadel/K8S/Makefile.local b/JugarAlPadel/K8S/Makefile.local index 8fe4cb9..fdb4761 100644 --- a/JugarAlPadel/K8S/Makefile.local +++ b/JugarAlPadel/K8S/Makefile.local @@ -1,5 +1,5 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') -export REGISTRY=localhost:5000 +export REGISTRY=localhost:30500 #export REGISTRY=registry.reymota.es export IMG_VERSION = 0.32 diff --git a/Registry/Makefile b/Registry/Makefile new file mode 100644 index 0000000..544defb --- /dev/null +++ b/Registry/Makefile @@ -0,0 +1,12 @@ +# limpia todo +all: clean install + +install: + -kubectl create -f namespace.yaml + -kubectl create -f pv-local-registry.yaml + -kubectl create -f registry-deployment.yaml + +clean: + -kubectl delete -f registry-deployment.yaml + -kubectl delete -f pv-local-registry.yaml + -kubectl delete -f namespace.yaml diff --git a/Registry/namespace.yaml b/Registry/namespace.yaml new file mode 100644 index 0000000..ad74fcd --- /dev/null +++ b/Registry/namespace.yaml @@ -0,0 +1,7 @@ +################################################### +# Namespace VehĂ­culos +################################################### +apiVersion: v1 +kind: Namespace +metadata: + name: registry diff --git a/Registry/pv-local-registry.yaml b/Registry/pv-local-registry.yaml new file mode 100644 index 0000000..9b1b562 --- /dev/null +++ b/Registry/pv-local-registry.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: registry-main-folder + labels: + app: mypdr +spec: + capacity: + storage: 100Mi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/Externo/registry" + diff --git a/Registry/registry-deployment.yaml b/Registry/registry-deployment.yaml new file mode 100644 index 0000000..14e4854 --- /dev/null +++ b/Registry/registry-deployment.yaml @@ -0,0 +1,69 @@ +apiVersion: v1 +kind: Service +metadata: + name: registry + namespace: registry + labels: + io.kompose.service: registry +spec: + type: NodePort + ports: + - name: registry + port: 5000 + protocol: TCP + nodePort: 30500 + targetPort: 5000 + selector: + io.kompose.service: registry +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: registry-claim0 + name: registry-claim0 + namespace: registry +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: registry-deployment + namespace: registry + labels: + k8s-app: registry +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: registry + strategy: + type: Recreate + template: + metadata: + labels: + io.kompose.service: registry + spec: + containers: + - env: + - name: REGISTRY_STORAGE_DELETE_ENABLED + value: "true" + image: registry:2.7 + name: registry + ports: + - containerPort: 5000 + imagePullPolicy: Always + volumeMounts: + - mountPath: /var/lib/registry + name: registry-claim0 + volumes: + - name: registry-claim0 + persistentVolumeClaim: + claimName: registry-claim0