Merge branch 'clase-5' into clase-6

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

View File

@ -7,19 +7,21 @@ spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
com.docker.project: node-app
app: node-app app: node-app
template: template:
metadata: metadata:
labels: labels:
com.docker.project: node-app
app: node-app app: node-app
spec: spec:
containers: containers:
- name: node-app - name: node-app
image: ubuntu image: node
command: command:
- "/bin/sh" - "/bin/sh"
- "-c" - "-c"
- "tail -f /dev/null" - "cd /app && npm install && node app.js"
env: env:
- name: PORT - name: PORT
value: "3000" value: "3000"
@ -39,23 +41,7 @@ spec:
cpu: "500m" cpu: "500m"
ports: ports:
- containerPort: 3000 - containerPort: 3000
lifecycle: protocol: TCP
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: volumeMounts:
- name: app-files - name: app-files
mountPath: /app/app.js 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) ![Diap2](./img/Diap2.png)
![Diap3](./img/Diap3.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) ![Diap4](../img/Agradecimiento.png)