Compare commits
3 Commits
clase-3-re
...
clase-5
Author | SHA1 | Date | |
---|---|---|---|
9f87869197 | |||
f1391bde3d | |||
fb9e6b7fa8 |
47
Clase 4/Ejercicio/hello-app/hello-app.yaml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: hello
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: my-hello-svc
|
||||||
|
namespace: hello
|
||||||
|
labels:
|
||||||
|
app: hello
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: hello
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8080
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: my-hello
|
||||||
|
namespace: hello
|
||||||
|
labels:
|
||||||
|
app: hello
|
||||||
|
spec:
|
||||||
|
replicas: 2
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: hello
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: hello
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: hello
|
||||||
|
image: gcr.io/google-samples/hello-app:1.0
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "128Mi"
|
||||||
|
cpu: "500m"
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
|
47
Clase 4/Ejercicio/nginx-app/nginx-app.yaml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: nginx
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: my-ngnix-svc
|
||||||
|
namespace: nginx
|
||||||
|
labels:
|
||||||
|
app: nginx
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: nginx
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 80
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: my-nginx
|
||||||
|
namespace: nginx
|
||||||
|
labels:
|
||||||
|
app: nginx
|
||||||
|
spec:
|
||||||
|
replicas: 2
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: nginx
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: nginx
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: nginx
|
||||||
|
image: nginx
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "128Mi"
|
||||||
|
cpu: "500m"
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
|
13
Clase 4/README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Clase 4
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|

|
BIN
Clase 4/img/Diap1.png
Normal file
After Width: | Height: | Size: 91 KiB |
BIN
Clase 4/img/Diap10.png
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
Clase 4/img/Diap2.png
Normal file
After Width: | Height: | Size: 265 KiB |
BIN
Clase 4/img/Diap3.png
Normal file
After Width: | Height: | Size: 76 KiB |
BIN
Clase 4/img/Diap4.png
Normal file
After Width: | Height: | Size: 154 KiB |
BIN
Clase 4/img/Diap5.png
Normal file
After Width: | Height: | Size: 147 KiB |
BIN
Clase 4/img/Diap6.png
Normal file
After Width: | Height: | Size: 105 KiB |
BIN
Clase 4/img/Diap7.png
Normal file
After Width: | Height: | Size: 129 KiB |
BIN
Clase 4/img/Diap8.png
Normal file
After Width: | Height: | Size: 128 KiB |
BIN
Clase 4/img/Diap9.png
Normal file
After Width: | Height: | Size: 87 KiB |
42
Clase 5/Ejercicio/node-show-text-app/configmap.yaml
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
55
Clase 5/Ejercicio/node-show-text-app/deployment.yaml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: node-app
|
||||||
|
namespace: node-app
|
||||||
|
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: node
|
||||||
|
command:
|
||||||
|
- "/bin/sh"
|
||||||
|
- "-c"
|
||||||
|
- "cd /app && npm install && node app.js"
|
||||||
|
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
|
||||||
|
protocol: TCP
|
||||||
|
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
|
4
Clase 5/Ejercicio/node-show-text-app/namespace.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: node-app
|
8
Clase 5/Ejercicio/node-show-text-app/secret.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: node-app-secret
|
||||||
|
namespace: node-app
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
secret: RXN0ZSBlcyB1biB0ZXh0byBzZWNyZXRvLg==
|
@ -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: {}
|
14
Clase 5/Ejercicio/node-show-text-app/service.yaml
Normal file
@ -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
|
9
Clase 5/README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Clase 5
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
Comando para entrar a la terminal de un contenedor:
|
||||||
|
`kubectl exec -n {namespace} --stdin --tty {pod-name} -- /bin/bash`
|
||||||
|
|
||||||
|

|
BIN
Clase 5/img/Diap1.png
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
Clase 5/img/Diap2.png
Normal file
After Width: | Height: | Size: 136 KiB |
BIN
Clase 5/img/Diap3.png
Normal file
After Width: | Height: | Size: 74 KiB |