Se mejora el ejercicio de la clase 5

This commit is contained in:
Alejandro Lembke Barrientos 2022-11-14 13:00:24 -06:00
parent f1391bde3d
commit 9f87869197
3 changed files with 24 additions and 19 deletions

View File

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

View File

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

View File

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