Skip to content

Commit b07fff8

Browse files
committed
new files & demos
1 parent ea0f309 commit b07fff8

File tree

8 files changed

+156
-0
lines changed

8 files changed

+156
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Deberes sesión 5 (Ingress)
2+
3+
# En la carpeta /demo-ingress hay 4 manifiestos YAML que despliegan la web y una API.
4+
#
5+
# Crea recursos ingress que:
6+
#
7+
# 1. Expongan la web a través de la ruta my-cluster.com/
8+
# 2. Expongan la api a través de la ruta my-cluster.com/api
9+
# 3. Expongan la api (otra vez) a través de la ruta api.my-cluster.com
10+
#
11+
# Recuerda que deberás editar el fichero hosts (/etc/hosts o C:\windows\system32\drivers\etc\hosts) y usar como IP para el DNS my-cluster.com y api.my-cluster.com la IP del controlador ingress
12+
13+
# Para instalar un controlador ingress:
14+
15+
# NGINX: https://kubernetes.github.io/ingress-nginx/deploy/
16+
17+
# Si usais minikube: minikube addons enable ingress
18+
# En este caso al crear un ingress os dará una ip (kubectl get ing). Usad esta IP como nombre de host
19+
#
20+
# En MI caso, solo podía acceder a la IP que me daba Minikube a través de un contenedor de Docker enlazado a red de Docker minikube:
21+
#
22+
# docker run --network minikube -it busybox
23+
#
24+
# Eso supongo que es porque uso Minikube con el driver de Docker (donde Kubernetes se ejecuta como un contenedor). No he probado más opciones de Minikube. Si estáis en este caso, podeis hacer la prueba
25+
# desde el contenedor de busybox pero deberéis modificar el fichero /etc/hosts del contenedor y luego usar wget -qO- http://my-cluster.com p.ej.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
app: api
7+
name: api
8+
spec:
9+
ports:
10+
- port: 80
11+
protocol: TCP
12+
targetPort: 80
13+
selector:
14+
app: api
15+
status:
16+
loadBalancer: {}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
app: api
7+
name: api
8+
spec:
9+
replicas: 3
10+
selector:
11+
matchLabels:
12+
app: api
13+
strategy: {}
14+
template:
15+
metadata:
16+
creationTimestamp: null
17+
labels:
18+
app: api
19+
spec:
20+
containers:
21+
- image: lemoncodersbc/go-hello-world
22+
name: go-hello-world-web
23+
resources: {}
24+
status: {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
app: web
7+
name: web
8+
spec:
9+
ports:
10+
- port: 80
11+
protocol: TCP
12+
targetPort: 3000
13+
selector:
14+
app: web
15+
status:
16+
loadBalancer: {}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
app: web
7+
name: web
8+
spec:
9+
replicas: 2
10+
selector:
11+
matchLabels:
12+
app: web
13+
strategy: {}
14+
template:
15+
metadata:
16+
creationTimestamp: null
17+
labels:
18+
app: web
19+
spec:
20+
containers:
21+
- image: lemoncodersbc/hello-world-web:v1
22+
name: hello-world-web
23+
resources: {}
24+
status: {}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
app: info
7+
name: info
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: info
13+
strategy: {}
14+
template:
15+
metadata:
16+
creationTimestamp: null
17+
labels:
18+
app: info
19+
spec:
20+
volumes:
21+
- name: settings-vol
22+
configMap:
23+
name: settings
24+
- name: temp-vol
25+
emptyDir: {}
26+
containers:
27+
- image: lemoncodersbc/showinfo:v1
28+
name: showinfo2
29+
volumeMounts:
30+
- name: settings-vol
31+
mountPath: /app/settings
32+
- name: temp-vol
33+
mountPath: /app/tmp
34+
envFrom:
35+
- configMapRef:
36+
name: config
37+
- secretRef:
38+
name: private-data
39+
resources: {}
40+
status: {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Ejemplo de como enlazar un ConfigMap con un fichero a un volumen del pod
2+
3+
Para ello tenéis que crear el configmap:
4+
5+
```
6+
kubectl create cm settings --from-file settings.json=setting.json
7+
```
8+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"clave": "valor"
3+
}

0 commit comments

Comments
 (0)