Browse Source

Gitea en k8s. No funciona

main
Celestino Rey 1 year ago
parent
commit
84064e7022
27 changed files with 375 additions and 12 deletions
  1. +4
    -0
      Gitea-old/creaTodo.sh
  2. +0
    -0
      Gitea-old/gitea-deployment.yaml
  3. +0
    -0
      Gitea-old/gitea-namespace.yaml
  4. +13
    -0
      Gitea-old/kustomization.yaml
  5. +73
    -0
      Gitea-old/mysql-deployment-gitea.yaml
  6. +3
    -0
      Gitea-old/paraTodo.sh
  7. +57
    -0
      Gitea-old/php-myadmin-gitea-deployment.yaml
  8. +0
    -0
      Gitea-old/pv-local-gitea.yaml
  9. +11
    -0
      Gitea-old/pv-local-mysql-gitea.yaml
  10. +0
    -0
      Gitea-old/registry-secrets.yaml
  11. +3
    -0
      Gitea-old/terminapv.sh
  12. +44
    -0
      Gitea/010-deployment.yaml
  13. +34
    -0
      Gitea/020-volumes.yaml
  14. +17
    -0
      Gitea/030-network.yaml
  15. +8
    -0
      Gitea/README.md
  16. +0
    -2
      Gitea/creaTodo.sh
  17. +7
    -4
      Gitea/kustomization.yaml
  18. +3
    -3
      Gitea/mysql-deployment-gitea.yaml
  19. +34
    -0
      Gitea/nginx-deployment.yaml
  20. +20
    -0
      Gitea/nginx-service.yaml
  21. +4
    -0
      Gitea/nginx/Dockerfile
  22. +11
    -0
      Gitea/nginx/Makefile
  23. +17
    -0
      Gitea/nginx/nginx.conf
  24. +0
    -1
      Gitea/paraTodo.sh
  25. +2
    -2
      Gitea/php-myadmin-gitea-deployment.yaml
  26. +8
    -0
      Gitea/reg-secret.yaml
  27. +2
    -0
      NginxConf202311/README.md

+ 4
- 0
Gitea-old/creaTodo.sh View File

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

Gitea/gitea-deployment.yaml → Gitea-old/gitea-deployment.yaml View File


Gitea/gitea-namespace.yaml → Gitea-old/gitea-namespace.yaml View File


+ 13
- 0
Gitea-old/kustomization.yaml View File

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

+ 73
- 0
Gitea-old/mysql-deployment-gitea.yaml View File

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

+ 3
- 0
Gitea-old/paraTodo.sh View File

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

+ 57
- 0
Gitea-old/php-myadmin-gitea-deployment.yaml View File

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

Gitea/pv-local-gitea.yaml → Gitea-old/pv-local-gitea.yaml View File


+ 11
- 0
Gitea-old/pv-local-mysql-gitea.yaml View File

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

Gitea/registry-secrets.yaml → Gitea-old/registry-secrets.yaml View File


+ 3
- 0
Gitea-old/terminapv.sh View File

@ -0,0 +1,3 @@
kubectl patch pv gitea-folder -p '{"metadata":{"finalizers":null}}'
kubectl patch pv gitea-data -p '{"metadata":{"finalizers":null}}'

+ 44
- 0
Gitea/010-deployment.yaml View File

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

+ 34
- 0
Gitea/020-volumes.yaml View File

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

+ 17
- 0
Gitea/030-network.yaml View File

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

+ 8
- 0
Gitea/README.md View File

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

+ 0
- 2
Gitea/creaTodo.sh View File

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

+ 7
- 4
Gitea/kustomization.yaml View File

@ -1,13 +1,16 @@
secretGenerator:
- name: mysqlgitea-pass
namespace: gitea
namespace: gitea-repo
literals:
- password=Dsa-0213
- db_user=root
- db_passwd=Dsa-0213
resources:
- gitea-namespace.yaml
- registry-secrets.yaml
- reg-secret.yaml
- mysql-deployment-gitea.yaml
- gitea-deployment.yaml
- php-myadmin-gitea-deployment.yaml
- 010-deployment.yaml
- 020-volumes.yaml
- 030-network.yaml
- nginx-deployment.yaml
- nginx-service.yaml

+ 3
- 3
Gitea/mysql-deployment-gitea.yaml View File

@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: gitea-mysql
namespace: gitea
namespace: gitea-repo
labels:
app: gitea
spec:
@ -20,7 +20,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-gitea-pv-claim
namespace: gitea
namespace: gitea-repo
labels:
app: gitea
spec:
@ -34,7 +34,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: gitea-mysql
namespace: gitea
namespace: gitea-repo
labels:
app: gitea
spec:


+ 34
- 0
Gitea/nginx-deployment.yaml View File

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

+ 20
- 0
Gitea/nginx-service.yaml View File

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

+ 4
- 0
Gitea/nginx/Dockerfile View File

@ -0,0 +1,4 @@
FROM nginx:1.25
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d

+ 11
- 0
Gitea/nginx/Makefile View File

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

+ 17
- 0
Gitea/nginx/nginx.conf View File

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

+ 0
- 1
Gitea/paraTodo.sh View File

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

+ 2
- 2
Gitea/php-myadmin-gitea-deployment.yaml View File

@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: phpmyadmin-gitea
namespace: gitea
namespace: gitea-repo
labels:
app: gitea
spec:
@ -20,7 +20,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: phpmyadmin-gitea
namespace: gitea
namespace: gitea-repo
labels:
app: gitea
spec:


+ 8
- 0
Gitea/reg-secret.yaml View File

@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: myregistrykey
namespace: gitea-repo
data:
.dockerconfigjson: ewoJImF1dGhzIjogewoJCSJyZWdpc3RyeS5yZXltb3RhLmVzIjogewoJCQkiYXV0aCI6ICJZM0psZVd4dmNHVjZPbEpsZVMweE1UYzIiCgkJfQoJfQp9
type: kubernetes.io/dockerconfigjson

+ 2
- 0
NginxConf202311/README.md View File

@ -57,6 +57,8 @@ Listo. El resultado se ha escrito en un fichero en el mismo directorio desde don
Debería de estar en /root/dydns. El fichero se llama settings.txt y tiene que tener todos los dominios que hemos asociado a la ip pública.
¡ojo! el fichero settings.txt se borra antes de rellenarlo con el nuevo valor. hay que ejecutar el comando fuera del directorio /root/dynds y luego añadir el resultado al fichero /root/dyndns/settings.txt
finalmente, hay que estar vigilando que las ip pública no cambie y que si lo hace se ajuste oportunamente. Para ello se añade un crontab


Loading…
Cancel
Save