From 9f87869197ae8056a7f07d79f28ba03280e60c79 Mon Sep 17 00:00:00 2001 From: Alejandro Lembke Barrientos Date: Mon, 14 Nov 2022 13:00:24 -0600 Subject: [PATCH] Se mejora el ejercicio de la clase 5 --- .../node-show-text-app/deployment.yaml | 24 ++++--------------- .../service-load-balancer.yaml | 16 +++++++++++++ Clase 5/README.md | 3 +++ 3 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 Clase 5/Ejercicio/node-show-text-app/service-load-balancer.yaml diff --git a/Clase 5/Ejercicio/node-show-text-app/deployment.yaml b/Clase 5/Ejercicio/node-show-text-app/deployment.yaml index 8791d6d..571bc81 100644 --- a/Clase 5/Ejercicio/node-show-text-app/deployment.yaml +++ b/Clase 5/Ejercicio/node-show-text-app/deployment.yaml @@ -7,19 +7,21 @@ spec: replicas: 1 selector: matchLabels: + com.docker.project: node-app app: node-app template: metadata: labels: + com.docker.project: node-app app: node-app spec: containers: - name: node-app - image: ubuntu + image: node command: - "/bin/sh" - "-c" - - "tail -f /dev/null" + - "cd /app && npm install && node app.js" env: - name: PORT value: "3000" @@ -39,23 +41,7 @@ spec: 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" + protocol: TCP volumeMounts: - name: app-files mountPath: /app/app.js diff --git a/Clase 5/Ejercicio/node-show-text-app/service-load-balancer.yaml b/Clase 5/Ejercicio/node-show-text-app/service-load-balancer.yaml new file mode 100644 index 0000000..c302c3c --- /dev/null +++ b/Clase 5/Ejercicio/node-show-text-app/service-load-balancer.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: node-app-svc-lb + namespace: node-app +spec: + ports: + - name: 80-tcp + port: 80 + protocol: TCP + targetPort: 3000 + selector: + com.docker.project: node-app + type: LoadBalancer +status: + loadBalancer: {} \ No newline at end of file diff --git a/Clase 5/README.md b/Clase 5/README.md index 4003c40..f40575e 100644 --- a/Clase 5/README.md +++ b/Clase 5/README.md @@ -3,4 +3,7 @@ ![Diap2](./img/Diap2.png) ![Diap3](./img/Diap3.png) +Comando para entrar a la terminal de un contenedor: +`kubectl exec -n {namespace} --stdin --tty {pod-name} -- /bin/bash` + ![Diap4](../img/Agradecimiento.png)