| @ -0,0 +1,4 @@ | |||
| kubectl delete -f configmap.yaml | |||
| kubectl delete -f deployment.yaml | |||
| kubectl delete -f service.yaml | |||
| kubectl delete -f ingress.yaml | |||
| @ -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."; | |||
| } | |||
| } | |||
| @ -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 | |||
| @ -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 | |||
| @ -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 | |||
| @ -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 | |||
| @ -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,3 +1,4 @@ | |||
| kubectl create -f pv-local-nextcloud.yaml | |||
| kubectl create -f pv-local-mysql.yaml | |||
| kubectl create -k ./ | |||
| watch kubectl get all -n nextcloud | |||
| @ -1 +0,0 @@ | |||
| kubectl exec --stdin --tty $1 -n $2 -- /bin/bash | |||
| @ -0,0 +1 @@ | |||
| kubectl exec -ti deployment.apps/nextcloud-server -n nextcloud -- /bin/bash | |||
| @ -1,11 +1,13 @@ | |||
| secretGenerator: | |||
| - name: dbnc-pass | |||
| - name: mysqlnc-pass | |||
| namespace: nextcloud | |||
| literals: | |||
| - password=Rey-1176 | |||
| - password=Dsa-0213 | |||
| - db_user=root | |||
| - db_passwd=Rey-1176 | |||
| - db_passwd=Dsa-0213 | |||
| resources: | |||
| - nc-namespace.yaml | |||
| - pvc-nextcloud.yaml | |||
| - mysql-deployment.yaml | |||
| - php-deployment.yaml | |||
| - nextcloud-deployment.yaml | |||
| @ -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,2 +1,3 @@ | |||
| kubectl delete -k ./ | |||
| kubectl delete -f pv-local-nextcloud.yaml | |||
| kubectl delete -f pv-local-mysql.yaml | |||
| @ -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 | |||
| @ -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,3 +1,3 @@ | |||
| kubectl create -f pv-local-nginx.yaml | |||
| kubectl create -k ./ | |||
| watch kubectl get all | |||
| #watch kubectl get all | |||
| @ -0,0 +1 @@ | |||
| kubectl exec -ti deployment.apps/nginx-example -- /bin/bash | |||
| @ -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,2 +1,2 @@ | |||
| kubectl delete -k ./ | |||
| kubectl delete -f pv-local-nginx.yaml | |||
| kubectl delete -f pv-local-nginx.yaml | |||