| @ -0,0 +1,4 @@ | |||||
| kubectl create -f pv-local-mysql-gitea.yaml | |||||
| kubectl create -f pv-local-gitea.yaml | |||||
| kubectl create -k ./ | |||||
| #watch kubectl get all -n gitea | |||||
| @ -0,0 +1,13 @@ | |||||
| secretGenerator: | |||||
| - name: mysqlgitea-pass | |||||
| namespace: gitea | |||||
| literals: | |||||
| - password=Dsa-0213 | |||||
| - db_user=root | |||||
| - db_passwd=Dsa-0213 | |||||
| resources: | |||||
| - gitea-namespace.yaml | |||||
| - registry-secrets.yaml | |||||
| - mysql-deployment-gitea.yaml | |||||
| - gitea-deployment.yaml | |||||
| - php-myadmin-gitea-deployment.yaml | |||||
| @ -0,0 +1,73 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: gitea-mysql | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: mysql | |||||
| port: 3306 | |||||
| nodePort: 30782 | |||||
| targetPort: mysql | |||||
| selector: | |||||
| app: gitea | |||||
| tier: mysql | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| name: mysql-gitea-pv-claim | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 20Gi | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: gitea-mysql | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: gitea | |||||
| tier: mysql | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: gitea | |||||
| tier: mysql | |||||
| spec: | |||||
| containers: | |||||
| - image: mariadb:latest | |||||
| name: mysql | |||||
| env: | |||||
| - name: MYSQL_ROOT_PASSWORD | |||||
| valueFrom: | |||||
| secretKeyRef: | |||||
| name: mysqlgitea-pass | |||||
| key: password | |||||
| ports: | |||||
| - containerPort: 3306 | |||||
| name: mysql | |||||
| volumeMounts: | |||||
| - name: mysql-persistent-storage | |||||
| mountPath: /var/lib/mysql | |||||
| imagePullSecrets: | |||||
| - name: reg-cred-secret | |||||
| volumes: | |||||
| - name: mysql-persistent-storage | |||||
| persistentVolumeClaim: | |||||
| claimName: mysql-gitea-pv-claim | |||||
| @ -0,0 +1,3 @@ | |||||
| kubectl delete -k ./ | |||||
| kubectl delete -f pv-local-mysql-gitea.yaml | |||||
| kubectl delete -f pv-local-gitea.yaml | |||||
| @ -0,0 +1,57 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: phpmyadmin-gitea | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| selector: | |||||
| app: gitea | |||||
| tier: phpmyadmin | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: phpadmin | |||||
| port: 80 | |||||
| nodePort: 30781 | |||||
| targetPort: phpmyadm | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: phpmyadmin-gitea | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: gitea | |||||
| tier: phpmyadmin | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: gitea | |||||
| tier: phpmyadmin | |||||
| spec: | |||||
| containers: | |||||
| - name: phpmyadmin | |||||
| image: phpmyadmin | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| name: phpmyadm | |||||
| env: | |||||
| - name: PMA_HOST | |||||
| value: gitea-mysql | |||||
| - name: PMA_PORT | |||||
| value: "3306" | |||||
| - name: MYSQL_ROOT_PASSWORD | |||||
| valueFrom: | |||||
| secretKeyRef: | |||||
| name: mysqlgitea-pass | |||||
| key: password | |||||
| imagePullSecrets: | |||||
| - name: reg-cred-secret | |||||
| @ -0,0 +1,11 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: gitea-data | |||||
| spec: | |||||
| capacity: | |||||
| storage: 20Gi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/gitea/gitea-db" | |||||
| @ -0,0 +1,3 @@ | |||||
| kubectl patch pv gitea-folder -p '{"metadata":{"finalizers":null}}' | |||||
| kubectl patch pv gitea-data -p '{"metadata":{"finalizers":null}}' | |||||
| @ -0,0 +1,44 @@ | |||||
| ################################################### | |||||
| # Namespace Gitea | |||||
| ################################################### | |||||
| apiVersion: v1 | |||||
| kind: Namespace | |||||
| metadata: | |||||
| name: gitea-repo | |||||
| ############################### | |||||
| # Deplyoment Gitea | |||||
| ############################### | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: gitea | |||||
| namespace: gitea-repo | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: gitea | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| containers: | |||||
| - name: gitea | |||||
| image: gitea/gitea:1.13.2 | |||||
| ports: | |||||
| - containerPort: 3000 | |||||
| name: gitea | |||||
| - containerPort: 22 | |||||
| name: git-ssh | |||||
| volumeMounts: | |||||
| - mountPath: /data | |||||
| name: git-data | |||||
| volumes: | |||||
| - name: git-data | |||||
| persistentVolumeClaim: | |||||
| claimName: git-pvc | |||||
| @ -0,0 +1,34 @@ | |||||
| --- | |||||
| ################################################### | |||||
| # Persistence Volume Claim | |||||
| ################################################### | |||||
| kind: PersistentVolume | |||||
| apiVersion: v1 | |||||
| metadata: | |||||
| name: git-pv | |||||
| namespace: gitea-repo | |||||
| spec: | |||||
| capacity: | |||||
| storage: 5Gi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| claimRef: | |||||
| namespace: gitea-repo | |||||
| name: git-pvc | |||||
| hostPath: | |||||
| path: /mnt/Externo/gitea/data | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| name: git-pvc | |||||
| namespace: gitea-repo | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| storageClassName: "" | |||||
| resources: | |||||
| requests: | |||||
| storage: 5Gi | |||||
| volumeName: "git-pv" | |||||
| @ -0,0 +1,17 @@ | |||||
| ############################### | |||||
| # Service | |||||
| ############################### | |||||
| --- | |||||
| kind: Service | |||||
| apiVersion: v1 | |||||
| metadata: | |||||
| name: gitea | |||||
| namespace: gitea-repo | |||||
| spec: | |||||
| selector: | |||||
| app: gitea | |||||
| ports: | |||||
| - name: gitea-http | |||||
| port: 3000 | |||||
| - name: gitea-ssh | |||||
| port: 22 | |||||
| @ -0,0 +1,8 @@ | |||||
| # Fuente | |||||
| https://ralph.blog.imixs.com/2021/02/25/running-gitea-on-kubernetes/ | |||||
| # habilitar ssh | |||||
| https://docs.github.com/en/authentication/troubleshooting-ssh/error-permission-denied-publickey#verify-the-public-key-is-attached-to-your-account | |||||
| @ -1,4 +1,2 @@ | |||||
| kubectl create -f pv-local-mysql-gitea.yaml | kubectl create -f pv-local-mysql-gitea.yaml | ||||
| kubectl create -f pv-local-gitea.yaml | |||||
| kubectl create -k ./ | kubectl create -k ./ | ||||
| #watch kubectl get all -n gitea | |||||
| @ -1,13 +1,16 @@ | |||||
| secretGenerator: | secretGenerator: | ||||
| - name: mysqlgitea-pass | - name: mysqlgitea-pass | ||||
| namespace: gitea | |||||
| namespace: gitea-repo | |||||
| literals: | literals: | ||||
| - password=Dsa-0213 | - password=Dsa-0213 | ||||
| - db_user=root | - db_user=root | ||||
| - db_passwd=Dsa-0213 | - db_passwd=Dsa-0213 | ||||
| resources: | resources: | ||||
| - gitea-namespace.yaml | |||||
| - registry-secrets.yaml | |||||
| - reg-secret.yaml | |||||
| - mysql-deployment-gitea.yaml | - mysql-deployment-gitea.yaml | ||||
| - gitea-deployment.yaml | |||||
| - php-myadmin-gitea-deployment.yaml | - php-myadmin-gitea-deployment.yaml | ||||
| - 010-deployment.yaml | |||||
| - 020-volumes.yaml | |||||
| - 030-network.yaml | |||||
| - nginx-deployment.yaml | |||||
| - nginx-service.yaml | |||||
| @ -0,0 +1,34 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: nginx | |||||
| name: nginx | |||||
| namespace: gitea-repo | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| io.kompose.service: nginx | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: nginx | |||||
| spec: | |||||
| containers: | |||||
| - image: registry.reymota.es/nginx-gitea-x86_64:1.18 | |||||
| name: nginx | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| protocol: TCP | |||||
| imagePullSecrets: | |||||
| - name: myregistrykey | |||||
| restartPolicy: Always | |||||
| @ -0,0 +1,20 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: nginx | |||||
| name: nginx | |||||
| namespace: gitea-repo | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: "80" | |||||
| port: 80 | |||||
| nodePort: 30780 | |||||
| targetPort: 80 | |||||
| selector: | |||||
| io.kompose.service: nginx | |||||
| @ -0,0 +1,4 @@ | |||||
| FROM nginx:1.25 | |||||
| RUN rm /etc/nginx/conf.d/default.conf | |||||
| COPY nginx.conf /etc/nginx/conf.d | |||||
| @ -0,0 +1,11 @@ | |||||
| export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') | |||||
| export IMG_NGINX_VERSION = 1.18 | |||||
| install: | |||||
| echo "Creando imagen con version ${IMG_NGINX_VERSION} para la arquitectura ${ARQUITECTURA}" | |||||
| docker build --no-cache -t registry.reymota.es/nginx-gitea-${ARQUITECTURA}:${IMG_NGINX_VERSION} . | |||||
| docker push registry.reymota.es/nginx-gitea-${ARQUITECTURA}:${IMG_NGINX_VERSION} | |||||
| @ -0,0 +1,17 @@ | |||||
| upstream gitea { | |||||
| server gitea:3000; | |||||
| } | |||||
| server { | |||||
| listen 80; | |||||
| location / { | |||||
| proxy_pass http://gitea; | |||||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |||||
| proxy_set_header Host $http_host; | |||||
| proxy_redirect off; | |||||
| client_max_body_size 100M; | |||||
| } | |||||
| } | |||||
| @ -1,3 +1,2 @@ | |||||
| kubectl delete -k ./ | kubectl delete -k ./ | ||||
| kubectl delete -f pv-local-mysql-gitea.yaml | kubectl delete -f pv-local-mysql-gitea.yaml | ||||
| kubectl delete -f pv-local-gitea.yaml | |||||
| @ -0,0 +1,8 @@ | |||||
| apiVersion: v1 | |||||
| kind: Secret | |||||
| metadata: | |||||
| name: myregistrykey | |||||
| namespace: gitea-repo | |||||
| data: | |||||
| .dockerconfigjson: ewoJImF1dGhzIjogewoJCSJyZWdpc3RyeS5yZXltb3RhLmVzIjogewoJCQkiYXV0aCI6ICJZM0psZVd4dmNHVjZPbEpsZVMweE1UYzIiCgkJfQoJfQp9 | |||||
| type: kubernetes.io/dockerconfigjson | |||||