diff --git a/Drupal/drupal-deployment.yaml b/Drupal/drupal-deployment.yaml index 5f3cdfea..8f47101e 100644 --- a/Drupal/drupal-deployment.yaml +++ b/Drupal/drupal-deployment.yaml @@ -6,10 +6,8 @@ metadata: labels: app: drupal spec: - type: NodePort ports: - port: 80 - nodePort: 30898 targetPort: drupal selector: app: drupal diff --git a/Drupal/drupal-deployment.yaml.NodePort b/Drupal/drupal-deployment.yaml.NodePort new file mode 100644 index 00000000..5f3cdfea --- /dev/null +++ b/Drupal/drupal-deployment.yaml.NodePort @@ -0,0 +1,101 @@ +apiVersion: v1 +kind: Service +metadata: + name: drupal + namespace: drupal + labels: + app: drupal +spec: + type: NodePort + ports: + - port: 80 + nodePort: 30898 + targetPort: drupal + selector: + app: drupal + tier: frontend +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: drupal-pv-claim + namespace: drupal + labels: + app: drupal +spec: + accessModes: + - ReadWriteOnce + storageClassName: "" + resources: + requests: + storage: 10Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: drupal + namespace: drupal + labels: + app: drupal +spec: + selector: + matchLabels: + app: drupal + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: drupal + tier: frontend + spec: + initContainers: + - + name: init-sites-volume + image: drupal:latest + command: ['/bin/bash', '-c'] + args: ['cp -r /var/www/html/sites/ /data/; chown www-data:www-data /data/ -R'] + volumeMounts: + - mountPath: /data + name: drupal-persistent-storage + containers: + - image: drupal:latest + name: drupal + env: + - name: DB_TYPE + value: mysql + - name: DB_NAME + value: drupal + - name: DB_HOST + value: drupal-mysql + - name: DB_PASS + valueFrom: + secretKeyRef: + name: mysqldrupal-pass + key: password + - name: DB_USER + valueFrom: + secretKeyRef: + name: mysqldrupal-pass + key: db_user + ports: + - containerPort: 80 + name: drupal + volumeMounts: + - name: drupal-persistent-storage + mountPath: /var/www/html/modules + subPath: modules + - name: drupal-persistent-storage + mountPath: /var/www/html/profiles + subPath: profiles + - name: drupal-persistent-storage + mountPath: /var/www/html/sites + subPath: sites + - name: drupal-persistent-storage + mountPath: /var/www/html/themes + subPath: themes + volumes: + - name: drupal-persistent-storage + persistentVolumeClaim: + claimName: drupal-pv-claim diff --git a/Drupal/ingress.yaml b/Drupal/ingress.yaml new file mode 100644 index 00000000..2d0c8a9b --- /dev/null +++ b/Drupal/ingress.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: drupal-ingress + namespace: drupal +spec: + ingressClassName: nginx + rules: + - host: "reymota.ddns.net" + http: + paths: + - pathType: Prefix + path: "/drupal" + backend: + service: + name: drupal + port: + number: 80 diff --git a/Https/app.yaml b/Https/app.yaml new file mode 100644 index 00000000..bd001de7 --- /dev/null +++ b/Https/app.yaml @@ -0,0 +1,59 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: minimal-ingress + annotations: + kubernetes.io/ingress.class: "nginx" + cert-manager.io/cluster-issuer: "letsencrypt" +spec: + tls: + - hosts: + - reymota.ddns.net + secretName: letsencrypt + rules: + - host: reymota.ddns.net + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: app + port: + number: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: app +spec: + selector: + app: app + type: NodePort + ports: + - name: http + port: 80 + nodePort: 30580 + targetPort: 80 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-deployment + labels: + app: app +spec: + replicas: 1 + selector: + matchLabels: + app: app + template: + metadata: + labels: + app: app + spec: + containers: + - name: app + image: nginx:latest + ports: + - containerPort: 80 diff --git a/Https/borra.sh b/Https/borra.sh deleted file mode 100644 index 19915302..00000000 --- a/Https/borra.sh +++ /dev/null @@ -1,4 +0,0 @@ -kubectl delete -f configmap.yaml -kubectl delete -f deployment.yaml -kubectl delete -f service.yaml -kubectl delete -f ingress.yaml diff --git a/Https/configmap.yaml b/Https/configmap.yaml deleted file mode 100644 index d65a1b21..00000000 --- a/Https/configmap.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: https-config -data: - default.conf: | - server { - listen 80; - listen [::]:80; - server_name _; - location / { - add_header Content-Type text/plain; # Prevents download - return 200 "¡Hola mundo! Demo de Kubernetes + Let's encrypt."; - } - } - diff --git a/Https/crea.sh b/Https/crea.sh deleted file mode 100644 index 29356800..00000000 --- a/Https/crea.sh +++ /dev/null @@ -1,6 +0,0 @@ -kubectl create -f configmap.yaml -kubectl create -f deployment.yaml -kubectl create -f service.yaml -kubectl create -f ingress.yaml -watch kubectl get all -kubectl describe ing kubernetes-demo-app-ingress-service diff --git a/Https/creaCertManager.sh b/Https/creaCertManager.sh new file mode 100644 index 00000000..fd9908c1 --- /dev/null +++ b/Https/creaCertManager.sh @@ -0,0 +1 @@ +kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.10.0/cert-manager.yaml diff --git a/Https/deployment.yaml b/Https/deployment.yaml deleted file mode 100644 index fe0459d9..00000000 --- a/Https/deployment.yaml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: https - labels: - app: https -spec: - selector: - matchLabels: - app: https - tier: frontend - strategy: - type: Recreate - template: - metadata: - labels: - app: https - tier: frontend - spec: - containers: - - image: nginx - name: https - ports: - - containerPort: 80 - volumeMounts: - - name: https-configs - mountPath: /etc/nginx/conf.d - # Load the configuration files for nginx - volumes: - - name: https-configs - configMap: - name: https-config - diff --git a/Https/ejemplo.yaml b/Https/ejemplo.yaml deleted file mode 100644 index f92289c3..00000000 --- a/Https/ejemplo.yaml +++ /dev/null @@ -1,52 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: nginx-config -data: - default.conf: | - server { - listen 80; - listen [::]:80; - server_name _; - location / { - add_header Content-Type text/plain; # Prevents download - return 200 "Hello world! Kubernetes + Let's encrypt demo."; - } ---- -apiVersion: v1 -kind: Deployment -metadata: - labels: - app: nginx - name: nginx -spec: - replicas: 1 - template: - metadata: - labels: - app: nginx - spec: - containers: - - name: nginx - image: nginx - ports: - - containerPort: 80 - volumeMounts: - - name: nginx-configs - mountPath: /etc/nginx/conf.d - # Load the configuration files for nginx - volumes: - - name: nginx-configs - configMap: - name: nginx-config ---- -apiVersion: v1 -kind: Service -metadata: - name: nginx -spec: - selector: - app: nginx - ports: - - protocol: "TCP" - port: 80 diff --git a/Https/ingress.yaml b/Https/ingress.yaml deleted file mode 100644 index 783f1c1f..00000000 --- a/Https/ingress.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: "kubernetes-demo-app-ingress-service" -spec: - rules: - - host: kubernetes-letsencrypt.jorge.fail - http: - paths: - # The * is needed so that all traffic gets redirected to nginx - - path: /* - pathType: Prefix - backend: - service: - name: https - port: - number: 80 diff --git a/Https/nginx-ingress.yaml b/Https/nginx-ingress.yaml new file mode 100644 index 00000000..c2ecabc2 --- /dev/null +++ b/Https/nginx-ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: minimal-ingress + annotations: + kubernetes.io/ingress.class: "nginx" + cert-manager.io/cluster-issuer: "letsencrypt" +spec: + tls: + - hosts: + - reymota.ddns.net + secretName: letsencrypt + rules: + - host: reymota.ddns.net + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: nginx-example + port: + number: 443 diff --git a/Https/nginx-issuer.yaml b/Https/nginx-issuer.yaml new file mode 100644 index 00000000..b27e8afc --- /dev/null +++ b/Https/nginx-issuer.yaml @@ -0,0 +1,15 @@ +apiVersion: cert-manager.io/v1 +kind: ClusterIssuer +metadata: + name: letsencrypt + namespace: cert-manager +spec: + acme: + server: https://acme-v02.api.letsencrypt.org/directory + email: celestino.rey@gmail.com + privateKeySecretRef: + name: letsencrypt + solvers: + - http01: + ingress: + class: nginx diff --git a/Https/service.yaml b/Https/service.yaml deleted file mode 100644 index b0651512..00000000 --- a/Https/service.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: https -spec: - selector: - app: https - type: NodePort - ports: - - protocol: "TCP" - port: 80 - nodePort: 30058 diff --git a/Mastodon/creaTodo.sh b/Mastodon/creaTodo.sh new file mode 100755 index 00000000..01ef1714 --- /dev/null +++ b/Mastodon/creaTodo.sh @@ -0,0 +1,2 @@ +kubectl create -k ./ +watch kubectl get all -n mastodon diff --git a/Mastodon/entra.sh b/Mastodon/entra.sh new file mode 100755 index 00000000..aeff2a9c --- /dev/null +++ b/Mastodon/entra.sh @@ -0,0 +1 @@ +kubectl exec -ti deployment.apps/mastodon-pgsql -n mastodon -- /bin/bash diff --git a/Mastodon/kube_service_create.sh b/Mastodon/kube_service_create.sh new file mode 100644 index 00000000..76db1769 --- /dev/null +++ b/Mastodon/kube_service_create.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +kubectl create -f pgadmin.yaml +sleep 15s +kubectl logs pgadmin-76gjgvvjh-yghg +## Access pgAdmin +## https://:31560 +## username/password: user@e-mail.com / password diff --git a/Mastodon/kustomization.yaml b/Mastodon/kustomization.yaml new file mode 100644 index 00000000..72c4aa90 --- /dev/null +++ b/Mastodon/kustomization.yaml @@ -0,0 +1,12 @@ +secretGenerator: +- name: pgsql-pass + namespace: mastodon + literals: + - password=Dsa-0213 + - db_user=root + - db_passwd=Dsa-0213 +resources: + - pv-local-pgsql.yaml + - namespace.yaml + - postgresql-deployment.yaml + - pgadmin.yaml diff --git a/Mastodon/namespace.yaml b/Mastodon/namespace.yaml new file mode 100644 index 00000000..6a097576 --- /dev/null +++ b/Mastodon/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: mastodon diff --git a/Mastodon/paraTodo.sh b/Mastodon/paraTodo.sh new file mode 100755 index 00000000..516ef9ac --- /dev/null +++ b/Mastodon/paraTodo.sh @@ -0,0 +1 @@ +kubectl delete -k ./ diff --git a/Mastodon/pgadmin.yaml b/Mastodon/pgadmin.yaml new file mode 100644 index 00000000..426b0671 --- /dev/null +++ b/Mastodon/pgadmin.yaml @@ -0,0 +1,49 @@ +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: pgadmin + name: pgadmin + namespace: mastodon +spec: + ports: + - name: padmin-port + nodePort: 30165 + port: 80 + targetPort: 80 + selector: + app: pgadmin + type: NodePort +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: pgadmin + namespace: mastodon +spec: + replicas: 1 + selector: + matchLabels: + app: pgadmin + template: + metadata: + labels: + app: pgadmin + spec: + containers: + - env: + - name: PGADMIN_DEFAULT_EMAIL + value: celestino.rey@gmail.com + - name: PGADMIN_DEFAULT_PASSWORD + value: Rey-1176 + - name: PGADMIN_PORT + value: "80" + image: dpage/pgadmin4:3.6 + imagePullPolicy: IfNotPresent + name: pgadmin + ports: + - containerPort: 80 + resources: + limits: + memory: 4096Mi diff --git a/Mastodon/postgresql-deployment.yaml b/Mastodon/postgresql-deployment.yaml new file mode 100644 index 00000000..67388375 --- /dev/null +++ b/Mastodon/postgresql-deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: v1 +kind: Service +metadata: + name: mastodon-pgsql + namespace: mastodon + labels: + app: mastodon +spec: + type: NodePort + ports: + - port: 5432 + name: pgsql + nodePort: 30798 + targetPort: pgsql + selector: + app: mastodon + tier: pgsql +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: pgsql-pv-claim + namespace: mastodon + labels: + app: mastodon +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mastodon-pgsql + namespace: mastodon + labels: + app: mastodon +spec: + selector: + matchLabels: + app: mastodon + tier: pgsql + strategy: + type: Recreate + template: + metadata: + labels: + app: mastodon + tier: pgsql + spec: + containers: + - image: postgres + name: pgsql + env: + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: pgsql-pass + key: password + volumeMounts: + - name: pgsql-persistent-storage + mountPath: /var/lib/postgresql/data + volumes: + - name: pgsql-persistent-storage + persistentVolumeClaim: + claimName: pgsql-pv-claim diff --git a/Mastodon/pv-local-pgsql.yaml b/Mastodon/pv-local-pgsql.yaml new file mode 100644 index 00000000..173780a4 --- /dev/null +++ b/Mastodon/pv-local-pgsql.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pg-data +spec: + capacity: + storage: 20Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/cluster/mastodon/mastodon-db" diff --git a/Metallb/borraML.sh b/Metallb/borraML.sh new file mode 100644 index 00000000..c311749d --- /dev/null +++ b/Metallb/borraML.sh @@ -0,0 +1 @@ +kubectl delete -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml diff --git a/Metallb/borraNginsIngres.sh b/Metallb/borraNginsIngres.sh new file mode 100644 index 00000000..a666ed1d --- /dev/null +++ b/Metallb/borraNginsIngres.sh @@ -0,0 +1 @@ +kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/cloud/deploy.yaml diff --git a/Metallb/creaML.sh b/Metallb/creaML.sh new file mode 100644 index 00000000..35ec1634 --- /dev/null +++ b/Metallb/creaML.sh @@ -0,0 +1,4 @@ +kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml +watch kubectl get all -n metallb-system +kubectl apply -f ipaddresspool.yaml +kubectl apply -f announceips.yaml diff --git a/Metallb/creaNginxIngress.sh b/Metallb/creaNginxIngress.sh new file mode 100644 index 00000000..00f990c8 --- /dev/null +++ b/Metallb/creaNginxIngress.sh @@ -0,0 +1 @@ +kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/cloud/deploy.yaml diff --git a/Metallb/describeIngress.sh b/Metallb/describeIngress.sh new file mode 100644 index 00000000..3995d06d --- /dev/null +++ b/Metallb/describeIngress.sh @@ -0,0 +1 @@ +kubectl describe ingress.networking.k8s.io nginx-ingress diff --git a/Metallb/pruebas/apple.yaml b/Metallb/pruebas/apple.yaml new file mode 100644 index 00000000..f4b5d18c --- /dev/null +++ b/Metallb/pruebas/apple.yaml @@ -0,0 +1,25 @@ +kind: Pod +apiVersion: v1 +metadata: + name: apple-app + labels: + app: apple +spec: + containers: + - name: apple-app + image: hashicorp/http-echo + args: + - "-text=apple" + +--- + +kind: Service +apiVersion: v1 +metadata: + name: apple-service +spec: + type: LoadBalancer + selector: + app: apple + ports: + - port: 5678 # Default port for image diff --git a/Metallb/pruebas/banana.yaml b/Metallb/pruebas/banana.yaml new file mode 100644 index 00000000..256d2b0c --- /dev/null +++ b/Metallb/pruebas/banana.yaml @@ -0,0 +1,25 @@ +kind: Pod +apiVersion: v1 +metadata: + name: banana-app + labels: + app: banana +spec: + containers: + - name: banana-app + image: hashicorp/http-echo + args: + - "-text=banana" + +--- + +kind: Service +apiVersion: v1 +metadata: + name: banana-service +spec: + type: LoadBalancer + selector: + app: banana + ports: + - port: 5678 # Default port for image diff --git a/Metallb/creaNginx.sh b/Metallb/pruebas/creaNginx.sh similarity index 100% rename from Metallb/creaNginx.sh rename to Metallb/pruebas/creaNginx.sh diff --git a/Metallb/pruebas/rutas.yaml b/Metallb/pruebas/rutas.yaml new file mode 100644 index 00000000..9c94a6e8 --- /dev/null +++ b/Metallb/pruebas/rutas.yaml @@ -0,0 +1,31 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: example-ingress + annotations: + ingress.kubernetes.io/rewrite-target: / +spec: + rules: + - http: + paths: + - path: /apple + pathType: Prefix + backend: + service: + name: apple-service + port: + number: 5678 + - path: /banana + pathType: Prefix + backend: + service: + name: banana-service + port: + number: 5678 + - path: /wordpress + pathType: Prefix + backend: + service: + name: wordpress + port: + number: 80 diff --git a/Metallb/verDNSIngress.sh b/Metallb/verDNSIngress.sh new file mode 100644 index 00000000..3871663b --- /dev/null +++ b/Metallb/verDNSIngress.sh @@ -0,0 +1 @@ +kubectl --namespace ingress-nginx get services -o wide diff --git a/NextCloud/describeIngress.sh b/NextCloud/describeIngress.sh new file mode 100644 index 00000000..a018ba6e --- /dev/null +++ b/NextCloud/describeIngress.sh @@ -0,0 +1 @@ +kubectl describe ingress.networking.k8s.io nextcloud-ingress -n nextcloud diff --git a/NextCloud/ingress.yaml b/NextCloud/ingress.yaml new file mode 100644 index 00000000..aceb3217 --- /dev/null +++ b/NextCloud/ingress.yaml @@ -0,0 +1,20 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: nextcloud-ingress + namespace: nextcloud + annotations: + nginx.ingress.kubernetes.io/rewrite-target: /$2 +spec: + ingressClassName: nginx + rules: + - host: "reymota.ddns.net" + http: + paths: + - pathType: Prefix + path: "/nextcloud" + backend: + service: + name: nextcloud-server + port: + number: 80 diff --git a/NextCloud/nextcloud-deployment.yaml.NodePort b/NextCloud/nextcloud-deployment.yaml.NodePort new file mode 100644 index 00000000..e2f8b343 --- /dev/null +++ b/NextCloud/nextcloud-deployment.yaml.NodePort @@ -0,0 +1,48 @@ +apiVersion: v1 +kind: Service +metadata: + name: nextcloud-server + namespace: nextcloud + labels: + app: nextcloud +spec: + selector: + pod-label: nextcloud-server-pod + type: NodePort + ports: + - port: 80 + nodePort: 30289 + targetPort: nextcloud +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nextcloud-server + namespace: nextcloud + labels: + app: nextcloud +spec: + replicas: 1 + selector: + matchLabels: + pod-label: nextcloud-server-pod + template: + metadata: + labels: + pod-label: nextcloud-server-pod + spec: + containers: + - name: nextcloud + image: nextcloud + volumeMounts: + - name: server-storage + mountPath: /var/www/html + subPath: server-data + ports: + - containerPort: 80 + name: nextcloud + volumes: + - name: server-storage + persistentVolumeClaim: + claimName: dbnc-pv-claim + diff --git a/Nginx/ingress.yaml b/Nginx/ingress.yaml new file mode 100644 index 00000000..750e883d --- /dev/null +++ b/Nginx/ingress.yaml @@ -0,0 +1,17 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: reymota-ingress + annotations: + ingress.kubernetes.io/rewrite-target: / +spec: + rules: + - http: + paths: + - path: /nginx + pathType: Prefix + backend: + service: + name: nginx-example + port: + number: 80 diff --git a/Nginx/miweb-deployment.yaml b/Nginx/miweb-deployment.yaml index 4bbd6f9d..358bc8a4 100644 --- a/Nginx/miweb-deployment.yaml +++ b/Nginx/miweb-deployment.yaml @@ -47,15 +47,15 @@ spec: spec: containers: - name: nginx - #image: linuxserver/nginx - image: httpd + image: linuxserver/nginx + #image: httpd ports: - containerPort: 80 name: "nginx-http" volumeMounts: - name: nginx-www-folder - # mountPath: /config/www - mountPath: /usr/local/apache2/htdocs + mountPath: /config/www + #mountPath: /usr/local/apache2/htdocs volumes: - name: nginx-www-folder persistentVolumeClaim: diff --git a/Nginx/miweb-deployment.yaml.LoadB b/Nginx/miweb-deployment.yaml.LoadB new file mode 100644 index 00000000..b1ca00e5 --- /dev/null +++ b/Nginx/miweb-deployment.yaml.LoadB @@ -0,0 +1,60 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-example +spec: + type: LoadBalancer + ports: + - name: http + port: 80 + selector: + app: nginx +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nginx-pv-claim + labels: + app: nginx +spec: + accessModes: + - ReadWriteMany + storageClassName: "" + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-example + labels: + app: nginx +spec: + selector: + matchLabels: + app: nginx + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: nginx + tier: frontend + spec: + containers: + - name: nginx + #image: linuxserver/nginx + image: httpd + ports: + - containerPort: 80 + name: "nginx-http" + volumeMounts: + - name: nginx-www-folder + # mountPath: /config/www + mountPath: /usr/local/apache2/htdocs + volumes: + - name: nginx-www-folder + persistentVolumeClaim: + claimName: nginx-pv-claim diff --git a/Nginx/miweb-deployment.yaml.copia b/Nginx/miweb-deployment.yaml.copia new file mode 100644 index 00000000..4bbd6f9d --- /dev/null +++ b/Nginx/miweb-deployment.yaml.copia @@ -0,0 +1,62 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-example +spec: + type: NodePort + ports: + - name: http + port: 80 + nodePort: 30080 + targetPort: nginx-http + selector: + app: nginx +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nginx-pv-claim + labels: + app: nginx +spec: + accessModes: + - ReadWriteMany + storageClassName: "" + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-example + labels: + app: nginx +spec: + selector: + matchLabels: + app: nginx + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: nginx + tier: frontend + spec: + containers: + - name: nginx + #image: linuxserver/nginx + image: httpd + ports: + - containerPort: 80 + name: "nginx-http" + volumeMounts: + - name: nginx-www-folder + # mountPath: /config/www + mountPath: /usr/local/apache2/htdocs + volumes: + - name: nginx-www-folder + persistentVolumeClaim: + claimName: nginx-pv-claim diff --git a/NginxIngress/creaTodo.sh b/NginxIngress/creaTodo.sh new file mode 100755 index 00000000..ee1e0e4e --- /dev/null +++ b/NginxIngress/creaTodo.sh @@ -0,0 +1,3 @@ +kubectl create -f pv-local-nginx.yaml +kubectl create -k ./ +#watch kubectl get all diff --git a/NginxIngress/entra.sh b/NginxIngress/entra.sh new file mode 100644 index 00000000..ee7256f2 --- /dev/null +++ b/NginxIngress/entra.sh @@ -0,0 +1 @@ +kubectl exec -ti deployment.apps/nginx-crey -- /bin/bash diff --git a/NginxIngress/ingress.yaml b/NginxIngress/ingress.yaml new file mode 100644 index 00000000..cf5e34b4 --- /dev/null +++ b/NginxIngress/ingress.yaml @@ -0,0 +1,16 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: nginx-ingress +spec: + ingressClassName: nginx + rules: + - http: + paths: + - pathType: Prefix + path: / + backend: + service: + name: nginx-crey + port: + number: 80 diff --git a/NginxIngress/kustomization.yaml b/NginxIngress/kustomization.yaml new file mode 100644 index 00000000..1ea828d5 --- /dev/null +++ b/NginxIngress/kustomization.yaml @@ -0,0 +1,3 @@ +resources: + - miweb-deployment.yaml + - ingress.yaml diff --git a/NginxIngress/miweb-deployment.yaml b/NginxIngress/miweb-deployment.yaml new file mode 100644 index 00000000..5c6d460c --- /dev/null +++ b/NginxIngress/miweb-deployment.yaml @@ -0,0 +1,62 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-crey +spec: + type: ClusterIP + ports: + - name: http + port: 80 + targetPort: nginx-http + protocol: TCP + selector: + app: nginx +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nginx-pv-claim + labels: + app: nginx +spec: + accessModes: + - ReadWriteMany + storageClassName: "" + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-crey + labels: + app: nginx +spec: + selector: + matchLabels: + app: nginx + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: nginx + tier: frontend + spec: + containers: + - name: nginx + image: linuxserver/nginx + #image: httpd + ports: + - containerPort: 80 + name: "nginx-http" + volumeMounts: + - name: nginx-www-folder + mountPath: /config/www + #mountPath: /usr/local/apache2/htdocs + volumes: + - name: nginx-www-folder + persistentVolumeClaim: + claimName: nginx-pv-claim diff --git a/NginxIngress/miweb-deployment.yaml.LoadB b/NginxIngress/miweb-deployment.yaml.LoadB new file mode 100644 index 00000000..b1ca00e5 --- /dev/null +++ b/NginxIngress/miweb-deployment.yaml.LoadB @@ -0,0 +1,60 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-example +spec: + type: LoadBalancer + ports: + - name: http + port: 80 + selector: + app: nginx +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nginx-pv-claim + labels: + app: nginx +spec: + accessModes: + - ReadWriteMany + storageClassName: "" + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-example + labels: + app: nginx +spec: + selector: + matchLabels: + app: nginx + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: nginx + tier: frontend + spec: + containers: + - name: nginx + #image: linuxserver/nginx + image: httpd + ports: + - containerPort: 80 + name: "nginx-http" + volumeMounts: + - name: nginx-www-folder + # mountPath: /config/www + mountPath: /usr/local/apache2/htdocs + volumes: + - name: nginx-www-folder + persistentVolumeClaim: + claimName: nginx-pv-claim diff --git a/NginxIngress/miweb-deployment.yaml.copia b/NginxIngress/miweb-deployment.yaml.copia new file mode 100644 index 00000000..4bbd6f9d --- /dev/null +++ b/NginxIngress/miweb-deployment.yaml.copia @@ -0,0 +1,62 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-example +spec: + type: NodePort + ports: + - name: http + port: 80 + nodePort: 30080 + targetPort: nginx-http + selector: + app: nginx +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nginx-pv-claim + labels: + app: nginx +spec: + accessModes: + - ReadWriteMany + storageClassName: "" + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-example + labels: + app: nginx +spec: + selector: + matchLabels: + app: nginx + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: nginx + tier: frontend + spec: + containers: + - name: nginx + #image: linuxserver/nginx + image: httpd + ports: + - containerPort: 80 + name: "nginx-http" + volumeMounts: + - name: nginx-www-folder + # mountPath: /config/www + mountPath: /usr/local/apache2/htdocs + volumes: + - name: nginx-www-folder + persistentVolumeClaim: + claimName: nginx-pv-claim diff --git a/NginxIngress/miweb-https-deployment.yaml b/NginxIngress/miweb-https-deployment.yaml new file mode 100644 index 00000000..c0b66eb4 --- /dev/null +++ b/NginxIngress/miweb-https-deployment.yaml @@ -0,0 +1,63 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-example +spec: + type: NodePort + ports: + - name: http + port: 80 + nodePort: 30080 + targetPort: nginx-http + selector: + app: nginx +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nginx-pv-claim + labels: + app: nginx +spec: + accessModes: + - ReadWriteMany + storageClassName: "" + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-example + labels: + app: nginx +spec: + selector: + matchLabels: + app: nginx + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: nginx + tier: frontend + spec: + containers: + - name: nginx + image: steveltn/https-portal:1 + ports: + - containerPort: 80 + name: "nginx-http" + volumeMounts: + - name: nginx-www-folder + mountPath: /config/www + env: + - name: DOMAINS + value: 'reymota.ddns.net -> http://nginx:80' + volumes: + - name: nginx-www-folder + persistentVolumeClaim: + claimName: nginx-pv-claim diff --git a/NginxIngress/paraTodo.sh b/NginxIngress/paraTodo.sh new file mode 100755 index 00000000..6125f7a1 --- /dev/null +++ b/NginxIngress/paraTodo.sh @@ -0,0 +1,2 @@ +kubectl delete -k ./ +kubectl delete -f pv-local-nginx.yaml diff --git a/NginxIngress/pod.yaml b/NginxIngress/pod.yaml new file mode 100644 index 00000000..fad436cd --- /dev/null +++ b/NginxIngress/pod.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Pod +metadata: + name: nginx-example + labels: + app: nginx +spec: + containers: + - name: nginx + image: linuxserver/nginx + ports: + - containerPort: 80 + name: "nginx-http" + volumeMounts: + - name: nginx-www-folder + mountPath: /config/www + volumes: + - name: nginx-www-folder + persistentVolumeClaim: + claimName: nginx-pv-claim diff --git a/NginxIngress/pv-local-nginx.yaml b/NginxIngress/pv-local-nginx.yaml new file mode 100644 index 00000000..aafadf1e --- /dev/null +++ b/NginxIngress/pv-local-nginx.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: www-nginx-folder +spec: + capacity: + storage: 2Gi + accessModes: + - ReadWriteMany + hostPath: + path: "/mnt/cluster/nginx" diff --git a/NginxIngress/pv-nginx.yaml b/NginxIngress/pv-nginx.yaml new file mode 100644 index 00000000..5b6173db --- /dev/null +++ b/NginxIngress/pv-nginx.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: www-nginx-folder +spec: + capacity: + storage: 2Gi + accessModes: + - ReadWriteMany + nfs: + server: k8s-router + path: "/media/discoexterno/nginx" diff --git a/NginxIngress/pvc-nginx.yaml b/NginxIngress/pvc-nginx.yaml new file mode 100644 index 00000000..a8d80ec0 --- /dev/null +++ b/NginxIngress/pvc-nginx.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nginx-pv-claim + labels: + app: nginx +spec: + accessModes: + - ReadWriteMany + storageClassName: "" + resources: + requests: + storage: 2Gi diff --git a/NginxIngress/service-loadbalancer.yaml b/NginxIngress/service-loadbalancer.yaml new file mode 100644 index 00000000..aee0f554 --- /dev/null +++ b/NginxIngress/service-loadbalancer.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-lb +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: nginx-http + selector: + app: nginx diff --git a/NginxIngress/service-nodeport.yaml b/NginxIngress/service-nodeport.yaml new file mode 100644 index 00000000..464d902f --- /dev/null +++ b/NginxIngress/service-nodeport.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-example +spec: + type: NodePort + ports: + - name: http + port: 80 + nodePort: 30080 + targetPort: nginx-http + selector: + app: nginx diff --git a/Wordpress/describeIngress.sh b/Wordpress/describeIngress.sh new file mode 100644 index 00000000..9e3857d7 --- /dev/null +++ b/Wordpress/describeIngress.sh @@ -0,0 +1 @@ +kubectl describe ingress.networking.k8s.io wordpress-ingress -n wordpress diff --git a/Wordpress/ingress.yaml b/Wordpress/ingress.yaml new file mode 100644 index 00000000..b5618836 --- /dev/null +++ b/Wordpress/ingress.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: wordpress-ingress + namespace: wordpress +spec: + ingressClassName: nginx + rules: + - host: "reymota.ddns.net" + http: + paths: + - pathType: Prefix + path: "/wordpress" + backend: + service: + name: wordpress + port: + number: 80 diff --git a/Wordpress/wordpress-deployment.yaml.Ingress b/Wordpress/wordpress-deployment.yaml.Ingress new file mode 100755 index 00000000..472abaa4 --- /dev/null +++ b/Wordpress/wordpress-deployment.yaml.Ingress @@ -0,0 +1,76 @@ +apiVersion: v1 +kind: Service +metadata: + name: wordpress + namespace: wordpress + labels: + app: wordpress +spec: + ports: + - port: 80 + targetPort: wordpress + selector: + app: wordpress + tier: frontend +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: wp-pv-claim + namespace: wordpress + labels: + app: wordpress +spec: + accessModes: + - ReadWriteOnce + storageClassName: "" + resources: + requests: + storage: 10Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wordpress + namespace: wordpress + labels: + app: wordpress +spec: + selector: + matchLabels: + app: wordpress + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: wordpress + tier: frontend + spec: + containers: + - image: wordpress:5.7.2-php7.4-apache + name: wordpress + env: + - name: WORDPRESS_DB_HOST + value: wordpress-mysql + - name: WORDPRESS_DB_PASSWORD + valueFrom: + secretKeyRef: + name: mysqlwp-pass + key: password + - name: WORDPRESS_DB_USER + valueFrom: + secretKeyRef: + name: mysqlwp-pass + key: db_user + ports: + - containerPort: 80 + name: wordpress + volumeMounts: + - name: wordpress-persistent-storage + mountPath: /var/www/html + volumes: + - name: wordpress-persistent-storage + persistentVolumeClaim: + claimName: wp-pv-claim diff --git a/Wordpress/wordpress-deployment.yaml.sinIngress b/Wordpress/wordpress-deployment.yaml.sinIngress new file mode 100755 index 00000000..b4e35e89 --- /dev/null +++ b/Wordpress/wordpress-deployment.yaml.sinIngress @@ -0,0 +1,78 @@ +apiVersion: v1 +kind: Service +metadata: + name: wordpress + namespace: wordpress + labels: + app: wordpress +spec: + type: NodePort + ports: + - port: 80 + nodePort: 30088 + targetPort: wordpress + selector: + app: wordpress + tier: frontend +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: wp-pv-claim + namespace: wordpress + labels: + app: wordpress +spec: + accessModes: + - ReadWriteOnce + storageClassName: "" + resources: + requests: + storage: 10Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wordpress + namespace: wordpress + labels: + app: wordpress +spec: + selector: + matchLabels: + app: wordpress + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: wordpress + tier: frontend + spec: + containers: + - image: wordpress:5.7.2-php7.4-apache + name: wordpress + env: + - name: WORDPRESS_DB_HOST + value: wordpress-mysql + - name: WORDPRESS_DB_PASSWORD + valueFrom: + secretKeyRef: + name: mysqlwp-pass + key: password + - name: WORDPRESS_DB_USER + valueFrom: + secretKeyRef: + name: mysqlwp-pass + key: db_user + ports: + - containerPort: 80 + name: wordpress + volumeMounts: + - name: wordpress-persistent-storage + mountPath: /var/www/html + volumes: + - name: wordpress-persistent-storage + persistentVolumeClaim: + claimName: wp-pv-claim diff --git a/Wordpress/wp-ingress.yaml b/Wordpress/wp-ingress.yaml new file mode 100644 index 00000000..29a049a7 --- /dev/null +++ b/Wordpress/wp-ingress.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: wordpress-ingress + namespace: wordpress + annotations: + ingress.kubernetes.io/rewrite-target: / +spec: + rules: + - http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: wordpress + port: + number: 80 diff --git a/WordpressIngress/Papelera/pvc-nginx.yaml b/WordpressIngress/Papelera/pvc-nginx.yaml new file mode 100644 index 00000000..00a7a6c3 --- /dev/null +++ b/WordpressIngress/Papelera/pvc-nginx.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nginx-pv-claim + namespace: wordpress + labels: + app: nginx +spec: + accessModes: + - ReadWriteMany + storageClassName: "" + resources: + requests: + storage: 2Gi diff --git a/WordpressIngress/Papelera/pvc-wordpress.yaml b/WordpressIngress/Papelera/pvc-wordpress.yaml new file mode 100644 index 00000000..37cebcdb --- /dev/null +++ b/WordpressIngress/Papelera/pvc-wordpress.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: wp-pv-claim + namespace: wordpress + labels: + app: wordpress +spec: + accessModes: + - ReadWriteMany + storageClassName: "" + resources: + requests: + storage: 20Gi diff --git a/WordpressIngress/creaTodo.sh b/WordpressIngress/creaTodo.sh new file mode 100755 index 00000000..286979f5 --- /dev/null +++ b/WordpressIngress/creaTodo.sh @@ -0,0 +1,4 @@ +kubectl create -f pv-local-mysql.yaml +kubectl create -f pv-local-wordpress.yaml +kubectl create -k ./ +watch kubectl get all -n wordpress diff --git a/WordpressIngress/describeIngress.sh b/WordpressIngress/describeIngress.sh new file mode 100644 index 00000000..b39bd384 --- /dev/null +++ b/WordpressIngress/describeIngress.sh @@ -0,0 +1 @@ +kubectl describe ingress.networking.k8s.io wordpress -n wordpress diff --git a/WordpressIngress/entra.sh b/WordpressIngress/entra.sh new file mode 100755 index 00000000..51dd5bb8 --- /dev/null +++ b/WordpressIngress/entra.sh @@ -0,0 +1 @@ +kubectl exec -ti deployment.apps/wordpress -n wordpress -- /bin/bash diff --git a/WordpressIngress/index.php b/WordpressIngress/index.php new file mode 100644 index 00000000..cc2a532a --- /dev/null +++ b/WordpressIngress/index.php @@ -0,0 +1,17 @@ + $LOG +#echo "$comienzo - Sincronizacion con LaCie" + +if [ ! -f "$SINCRONIZANDO" ] +then + touch $SINCRONIZANDO + echo "Empieza sincronización..." >> $LOG + for i in fireflyiii nextcloud nginx reevolution wordpress + do + echo "Guardando '$i'..." >> $LOG +# sudo rsync -avh $ORIGEN/$i $DESTINO --delete >> $LOG + sudo rsync -avh $ORIGEN/$i $DESTINOext --delete >> $LOG + done + final=$(date "+%Y_%m_%d-%H_%M_%S") + echo "$final - Fin de sincronizacion con LaCie" >> $LOG + mensaje="Copia de seguridad del disco duro realizada en la LaCie CloudBox y en disco externo" + sudo -u creylopez cat $LOG | mail -s "Copia realizada" "celestino.rey@gmail.com" + rm $SINCRONIZANDO +else + echo "ya se está sincronizando" +fi