diff --git a/.DS_Store b/.DS_Store index f2af216..6f081f6 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index cc5ffdb..a88d11a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ CuestionarioKubernetes.docx Videos de Clase Hojas de Asistencia Clase 3/Clase 3.pptx -Clase 3/Ejercicio/nginx-app \ No newline at end of file +Clase 3/Ejercicio/nginx-app +Clase 4/Clase 4.pptx \ No newline at end of file diff --git a/Clase 1/.DS_Store b/Clase 1/.DS_Store index ef7dd80..352fcff 100644 Binary files a/Clase 1/.DS_Store and b/Clase 1/.DS_Store differ diff --git a/Clase 1/Ejercicio/.DS_Store b/Clase 1/Ejercicio/.DS_Store index 29d4177..6a28dc5 100644 Binary files a/Clase 1/Ejercicio/.DS_Store and b/Clase 1/Ejercicio/.DS_Store differ diff --git a/Clase 2/.DS_Store b/Clase 2/.DS_Store index c1db7d3..c62c457 100644 Binary files a/Clase 2/.DS_Store and b/Clase 2/.DS_Store differ diff --git a/Clase 2/Ejercicio/.DS_Store b/Clase 2/Ejercicio/.DS_Store index 9570fcf..5426c66 100644 Binary files a/Clase 2/Ejercicio/.DS_Store and b/Clase 2/Ejercicio/.DS_Store differ diff --git a/Clase 4/.DS_Store b/Clase 4/.DS_Store new file mode 100644 index 0000000..ea07b92 Binary files /dev/null and b/Clase 4/.DS_Store differ diff --git a/Clase 4/Ejercicio/node-show-text-app/configmap.yaml b/Clase 4/Ejercicio/node-show-text-app/configmap.yaml new file mode 100644 index 0000000..e3ea512 --- /dev/null +++ b/Clase 4/Ejercicio/node-show-text-app/configmap.yaml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: node-app-configmap + namespace: node-app +data: + # Mensaje personalizado + message: "Este es un mensaje personalizado." + # file-like keys + # Archivo de app (Código) + app.js: | + const express = require('express') + const app = express() + const port = process.env.PORT ? process.env.PORT : 80 + + app.get('/', (req, res) => { + res.send(process.env.MESSAGE ? process.env.MESSAGE : 'Hello World!') + }) + + app.get('/secret', (req, res) => { + res.send(process.env.SECRET ? process.env.SECRET : 'Hello Secret World!') + }) + + + app.listen(port, () => { + console.log(`Example app listening on port ${port}`) + }) + package.json: | + { + "name": "show-text-app", + "version": "1.0.0", + "description": "example app", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Alejandro Lembke Barrientos", + "license": "MIT", + "dependencies": { + "express": "^4.18.1" + } + } \ No newline at end of file diff --git a/Clase 4/Ejercicio/node-show-text-app/deployment.yaml b/Clase 4/Ejercicio/node-show-text-app/deployment.yaml new file mode 100644 index 0000000..8791d6d --- /dev/null +++ b/Clase 4/Ejercicio/node-show-text-app/deployment.yaml @@ -0,0 +1,69 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: node-app + namespace: node-app +spec: + replicas: 1 + selector: + matchLabels: + app: node-app + template: + metadata: + labels: + app: node-app + spec: + containers: + - name: node-app + image: ubuntu + command: + - "/bin/sh" + - "-c" + - "tail -f /dev/null" + env: + - name: PORT + value: "3000" + - name: SECRET + valueFrom: + secretKeyRef: + name: node-app-secret + key: secret + - name: MESSAGE + valueFrom: + configMapKeyRef: + name: node-app-configmap + key: message + resources: + limits: + memory: "128Mi" + cpu: "500m" + ports: + - containerPort: 3000 + lifecycle: + postStart: + exec: + command: + - "/bin/sh" + - "-c" + - "apt-get update" + - "&&" + - "apt-get install curl -y" + - "&&" + - "curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh" + - "&&" + - "bash nodesource_setup.sh" + - "&&" + - "apt install nodejs" + - "&&" + - "cd /app && npm install && node app.js" + volumeMounts: + - name: app-files + mountPath: /app/app.js + subPath: app.js + - name: app-files + mountPath: /app/package.json + subPath: package.json + volumes: + - name: app-files + configMap: + name: node-app-configmap \ No newline at end of file diff --git a/Clase 4/Ejercicio/node-show-text-app/namespace.yaml b/Clase 4/Ejercicio/node-show-text-app/namespace.yaml new file mode 100644 index 0000000..4875e50 --- /dev/null +++ b/Clase 4/Ejercicio/node-show-text-app/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: node-app \ No newline at end of file diff --git a/Clase 4/Ejercicio/node-show-text-app/secret.yaml b/Clase 4/Ejercicio/node-show-text-app/secret.yaml new file mode 100644 index 0000000..c16ae59 --- /dev/null +++ b/Clase 4/Ejercicio/node-show-text-app/secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: node-app-secret + namespace: node-app +type: Opaque +data: + secret: RXN0ZSBlcyB1biB0ZXh0byBzZWNyZXRvLg== diff --git a/Clase 4/Ejercicio/node-show-text-app/service.yaml b/Clase 4/Ejercicio/node-show-text-app/service.yaml new file mode 100644 index 0000000..7a69df2 --- /dev/null +++ b/Clase 4/Ejercicio/node-show-text-app/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: node-app-svc + namespace: node-app + labels: + app: node-app +spec: + type: ClusterIP + selector: + app: node-app + ports: + - port: 80 + targetPort: 3000 \ No newline at end of file