Browse Source

Cambios en Nextcloud para usar mysql.

Pruebas https
main
Celestino Rey 3 years ago
parent
commit
9c9cd9dffe
20 changed files with 351 additions and 8 deletions
  1. +4
    -0
      Https/borra.sh
  2. +16
    -0
      Https/configmap.yaml
  3. +6
    -0
      Https/crea.sh
  4. +33
    -0
      Https/deployment.yaml
  5. +52
    -0
      Https/ejemplo.yaml
  6. +17
    -0
      Https/ingress.yaml
  7. +12
    -0
      Https/service.yaml
  8. +1
    -0
      NextCloud/creaTodo.sh
  9. +0
    -1
      NextCloud/entra
  10. +1
    -0
      NextCloud/entra.sh
  11. +5
    -3
      NextCloud/kustomization.yaml
  12. +68
    -0
      NextCloud/mysql-deployment.yaml
  13. +1
    -0
      NextCloud/paraTodo.sh
  14. +54
    -0
      NextCloud/php-deployment.yaml
  15. +11
    -0
      NextCloud/pv-local-mysql.yaml
  16. +1
    -1
      Nginx/creaTodo.sh
  17. +1
    -0
      Nginx/entra.sh
  18. +4
    -2
      Nginx/miweb-deployment.yaml
  19. +63
    -0
      Nginx/miweb-https-deployment.yaml
  20. +1
    -1
      Nginx/paraTodo.sh

+ 4
- 0
Https/borra.sh View File

@ -0,0 +1,4 @@
kubectl delete -f configmap.yaml
kubectl delete -f deployment.yaml
kubectl delete -f service.yaml
kubectl delete -f ingress.yaml

+ 16
- 0
Https/configmap.yaml View File

@ -0,0 +1,16 @@
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.";
}
}

+ 6
- 0
Https/crea.sh View File

@ -0,0 +1,6 @@
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

+ 33
- 0
Https/deployment.yaml View File

@ -0,0 +1,33 @@
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

+ 52
- 0
Https/ejemplo.yaml View File

@ -0,0 +1,52 @@
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

+ 17
- 0
Https/ingress.yaml View File

@ -0,0 +1,17 @@
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

+ 12
- 0
Https/service.yaml View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: https
spec:
selector:
app: https
type: NodePort
ports:
- protocol: "TCP"
port: 80
nodePort: 30058

+ 1
- 0
NextCloud/creaTodo.sh View File

@ -1,3 +1,4 @@
kubectl create -f pv-local-nextcloud.yaml kubectl create -f pv-local-nextcloud.yaml
kubectl create -f pv-local-mysql.yaml
kubectl create -k ./ kubectl create -k ./
watch kubectl get all -n nextcloud watch kubectl get all -n nextcloud

+ 0
- 1
NextCloud/entra View File

@ -1 +0,0 @@
kubectl exec --stdin --tty $1 -n $2 -- /bin/bash

+ 1
- 0
NextCloud/entra.sh View File

@ -0,0 +1 @@
kubectl exec -ti deployment.apps/nextcloud-server -n nextcloud -- /bin/bash

+ 5
- 3
NextCloud/kustomization.yaml View File

@ -1,11 +1,13 @@
secretGenerator: secretGenerator:
- name: dbnc-pass
- name: mysqlnc-pass
namespace: nextcloud namespace: nextcloud
literals: literals:
- password=Rey-1176
- password=Dsa-0213
- db_user=root - db_user=root
- db_passwd=Rey-1176
- db_passwd=Dsa-0213
resources: resources:
- nc-namespace.yaml - nc-namespace.yaml
- pvc-nextcloud.yaml - pvc-nextcloud.yaml
- mysql-deployment.yaml
- php-deployment.yaml
- nextcloud-deployment.yaml - nextcloud-deployment.yaml

+ 68
- 0
NextCloud/mysql-deployment.yaml View File

@ -0,0 +1,68 @@
apiVersion: v1
kind: Service
metadata:
name: nextcloud-mysql
namespace: nextcloud
labels:
app: nextcloud
spec:
ports:
- port: 3306
selector:
app: nextcloud
tier: mysql
clusterIP: None
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-nc-pv-claim
namespace: nextcloud
labels:
app: nextcloud
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nextcloud-mysql
namespace: nextcloud
labels:
app: nextcloud
spec:
selector:
matchLabels:
app: nextcloud
tier: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: nextcloud
tier: mysql
spec:
containers:
- image: mariadb
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysqlnc-pass
key: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-nc-pv-claim

+ 1
- 0
NextCloud/paraTodo.sh View File

@ -1,2 +1,3 @@
kubectl delete -k ./ kubectl delete -k ./
kubectl delete -f pv-local-nextcloud.yaml kubectl delete -f pv-local-nextcloud.yaml
kubectl delete -f pv-local-mysql.yaml

+ 54
- 0
NextCloud/php-deployment.yaml View File

@ -0,0 +1,54 @@
apiVersion: v1
kind: Service
metadata:
name: phpmyadmin-nextcloud
namespace: nextcloud
labels:
app: nextcloud
spec:
selector:
app: nextcloud
tier: phpmyadmin
type: NodePort
ports:
- name: phpadmin
port: 80
nodePort: 30480
targetPort: phpmyadm
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: phpmyadmin-nextcloud
namespace: nextcloud
labels:
app: nextcloud
spec:
selector:
matchLabels:
app: nextcloud
tier: phpmyadmin
strategy:
type: Recreate
template:
metadata:
labels:
app: nextcloud
tier: phpmyadmin
spec:
containers:
- name: phpmyadmin
image: phpmyadmin
ports:
- containerPort: 80
name: phpmyadm
env:
- name: PMA_HOST
value: nextcloud-mysql
- name: PMA_PORT
value: "3306"
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysqlnc-pass
key: password

+ 11
- 0
NextCloud/pv-local-mysql.yaml View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: nc-data
spec:
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/cluster/nextcloud/nextcloud-db"

+ 1
- 1
Nginx/creaTodo.sh View File

@ -1,3 +1,3 @@
kubectl create -f pv-local-nginx.yaml kubectl create -f pv-local-nginx.yaml
kubectl create -k ./ kubectl create -k ./
watch kubectl get all
#watch kubectl get all

+ 1
- 0
Nginx/entra.sh View File

@ -0,0 +1 @@
kubectl exec -ti deployment.apps/nginx-example -- /bin/bash

+ 4
- 2
Nginx/miweb-deployment.yaml View File

@ -47,13 +47,15 @@ spec:
spec: spec:
containers: containers:
- name: nginx - name: nginx
image: linuxserver/nginx
#image: linuxserver/nginx
image: httpd
ports: ports:
- containerPort: 80 - containerPort: 80
name: "nginx-http" name: "nginx-http"
volumeMounts: volumeMounts:
- name: nginx-www-folder - name: nginx-www-folder
mountPath: /config/www
# mountPath: /config/www
mountPath: /usr/local/apache2/htdocs
volumes: volumes:
- name: nginx-www-folder - name: nginx-www-folder
persistentVolumeClaim: persistentVolumeClaim:


+ 63
- 0
Nginx/miweb-https-deployment.yaml View File

@ -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

+ 1
- 1
Nginx/paraTodo.sh View File

@ -1,2 +1,2 @@
kubectl delete -k ./ kubectl delete -k ./
kubectl delete -f pv-local-nginx.yaml
kubectl delete -f pv-local-nginx.yaml

Loading…
Cancel
Save