Browse Source

Preparación para k8s

politica
Celestino Rey 1 year ago
parent
commit
36281d32ef
8 changed files with 102 additions and 4 deletions
  1. +1
    -0
      ReymotaPy/K8S/entra.sh
  2. +14
    -0
      ReymotaPy/K8S/pv-local-reymotapy.yaml
  3. +53
    -0
      ReymotaPy/K8S/reymotapy-deployment.yaml
  4. +14
    -0
      ReymotaPy/K8S/reymotapy-prod-persistentvolumeclaim.yaml
  5. +1
    -0
      ReymotaPy/K8S/verImg.sh
  6. +4
    -4
      ReymotaPy/servicios/reymotapy/Dockerfile
  7. +14
    -0
      ReymotaPy/servicios/reymotapy/requirements.txt
  8. +1
    -0
      ReymotaPy/servicios/reymotapy/verImg.sh

+ 1
- 0
ReymotaPy/K8S/entra.sh View File

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

+ 14
- 0
ReymotaPy/K8S/pv-local-reymotapy.yaml View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: reymotapy-app-folder
labels:
app: reymotapy
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/reymotapy"

+ 53
- 0
ReymotaPy/K8S/reymotapy-deployment.yaml View File

@ -0,0 +1,53 @@
apiVersion: v1
kind: Service
metadata:
name: reymotapy
spec:
type: NodePort
ports:
- name: http
port: 5000
nodePort: 30338
targetPort: reymotapy
selector:
app: reymotapy
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: reymotapy
labels:
app: reymotapy
spec:
replicas: 1
selector:
matchLabels:
app: reymotapy
strategy:
type: Recreate
template:
metadata:
labels:
app: reymotapy
spec:
containers:
- args:
- gunicorn
- --bind
- 0.0.0.0:5000
- reymotapy:create_app()
image: creylopez/reymotapy:1.0
name: reymotapy
ports:
- containerPort: 5000
name: reymotapy
resources: {}
volumeMounts:
- mountPath: /reymotapy/instance
name: reymotapy-prod
restartPolicy: Always
volumes:
- name: reymotapy-prod
persistentVolumeClaim:
claimName: reymotapy-prod
status: {}

+ 14
- 0
ReymotaPy/K8S/reymotapy-prod-persistentvolumeclaim.yaml View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
labels:
io.kompose.service: reymotapy-prod
name: reymotapy-prod
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
status: {}

+ 1
- 0
ReymotaPy/K8S/verImg.sh View File

@ -0,0 +1 @@
docker run -it creylopez/lyrics:5.3 bash

+ 4
- 4
ReymotaPy/servicios/reymotapy/Dockerfile View File

@ -2,11 +2,11 @@
FROM python:3.8-slim-buster FROM python:3.8-slim-buster
WORKDIR /lyrics
WORKDIR /reymotapy
# set environment variables # set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# install system dependencies # install system dependencies
RUN apt-get update && apt-get install -y sqlite3 RUN apt-get update && apt-get install -y sqlite3
@ -17,4 +17,4 @@ RUN pip3 install -r requirements.txt
COPY . . COPY . .
# run entrypoint.sh # run entrypoint.sh
ENTRYPOINT ["/lyrics/entrypoint.sh"]
ENTRYPOINT ["/reymotapy/entrypoint.sh"]

+ 14
- 0
ReymotaPy/servicios/reymotapy/requirements.txt View File

@ -0,0 +1,14 @@
blinker==1.8.2
click==8.1.7
Flask==3.0.3
Flask-Login==0.6.3
Flask-SQLAlchemy==3.1.1
greenlet==3.0.3
gunicorn==22.0.0
itsdangerous==2.2.0
Jinja2==3.1.4
MarkupSafe==2.1.5
packaging==24.1
SQLAlchemy==2.0.31
typing_extensions==4.12.2
Werkzeug==3.0.3

+ 1
- 0
ReymotaPy/servicios/reymotapy/verImg.sh View File

@ -0,0 +1 @@
docker run -it creylopez/reymotapy:1.0 bash

Loading…
Cancel
Save