Skip to content

Commit

Permalink
Commit inicial
Browse files Browse the repository at this point in the history
  • Loading branch information
ualmtorres committed Nov 20, 2019
0 parents commit 048d7f9
Show file tree
Hide file tree
Showing 41 changed files with 263 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Ejemplos/Ejemplo01-hellominikube/hello-minikube.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port=8080

kubectl expose deployment hello-minikube --type=NodePort

minikube service hello-minikube
5 changes: 5 additions & 0 deletions Ejemplos/Ejemplo01-hellominikube/limpiarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

kubectl delete service hello-minikube

kubectl delete deployment hello-minikube
18 changes: 18 additions & 0 deletions Ejemplos/Ejemplo02-InformacionKubernetes/mostrarInformacion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

echo "*** Mostrando informacion del cluster"

kubectl cluster-info

echo "***"
echo "*** Mostrando información de los nodos"
echo "***"

kubectl get nodes

echo "***"
echo "*** Mostrando información de los objetos Kubernetes desplegados actualmente"
echo "***"

kubectl get all

10 changes: 10 additions & 0 deletions Ejemplos/Ejemplo03-DespliegueJSONProducer/lanzarDespliegue.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

kubectl run jsonproducer --image=ualmtorres/jsonproducer:v0 --port 80

kubectl get deployments

kubectl expose deployment jsonproducer --type=NodePort

minikube service jsonproducer

6 changes: 6 additions & 0 deletions Ejemplos/Ejemplo03-DespliegueJSONProducer/limpiarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

kubectl delete service jsonproducer

kubectl delete deployment jsonproducer

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

kubectl apply -f mongodb-basico.yaml

kubectl exec -it mongodb /bin/bash


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

kubectl delete -f mongodb-basico.yaml


Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Pod
metadata:
name: mongodb
spec:
containers:
- image: mongo
name: mongodb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

echo "***"
echo "*** Mostrando información del pod mongodb"
echo "***"

kubectl describe pod mongodb

echo "***"
echo "*** Mostrando logs del pod mongodb"
echo "***"

kubectl logs mongodb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

kubectl port-forward mongodb 27017:27017


3 changes: 3 additions & 0 deletions Ejemplos/Ejemplo05-SelectorEtiquetas/lanzarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

kubectl apply -f nginx.yaml
5 changes: 5 additions & 0 deletions Ejemplos/Ejemplo05-SelectorEtiquetas/limpiarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

kubectl delete -f nginx.yaml

kubectl delete pod -l app=apache
21 changes: 21 additions & 0 deletions Ejemplos/Ejemplo05-SelectorEtiquetas/nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: webcontainer
image: nginx
ports:
- containerPort: 80
5 changes: 5 additions & 0 deletions Ejemplos/Ejemplo06-Servicio/crearServicioJSONProducer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

kubectl run jsonproducer --image=ualmtorres/jsonproducer:v0 --port 80
kubectl expose deployment jsonproducer --type=NodePort
minikube service jsonproducer
4 changes: 4 additions & 0 deletions Ejemplos/Ejemplo06-Servicio/limpiarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl delete deployment jsonproducer
kubectl delete service jsonproducer
25 changes: 25 additions & 0 deletions Ejemplos/Ejemplo06-Servicio/mostrarInformacion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

echo "***"
echo "*** Mostrar deployments"
echo "***"

kubectl get deployments

echo "***"
echo "*** Mostrar replica sets"
echo "***"

kubectl get replicasets

echo "***"
echo "*** Mostrar servicios"
echo "***"

kubectl get services

echo "***"
echo "*** Mostrar pods"
echo "***"

kubectl get pods
1 change: 1 addition & 0 deletions Ejemplos/Ejemplo07-ConfigMaps/apellidos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
McQueen
5 changes: 5 additions & 0 deletions Ejemplos/Ejemplo07-ConfigMaps/crearConfigMaps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

kubectl create configmap datosmtorres --from-literal=nombre=Manuel --from-literal=apellidos=Torres

kubectl create configmap datosstevemcqueen --from-file=nombre=nombre.txt --from-file=apellidos=apellidos.txt
4 changes: 4 additions & 0 deletions Ejemplos/Ejemplo07-ConfigMaps/limpiarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl delete configmap datosmtorres
kubectl delete configmap datosstevemcqueen
4 changes: 4 additions & 0 deletions Ejemplos/Ejemplo07-ConfigMaps/mostrarConfigMaps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl describe configmap datosmtorres
kubectl describe configmap datosstevemcqueen
1 change: 1 addition & 0 deletions Ejemplos/Ejemplo07-ConfigMaps/nombre.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Steve
6 changes: 6 additions & 0 deletions Ejemplos/Ejemplo08-Secrets/crearSecrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret

kubectl create secret generic my-second-secret --from-file=key1=key1.txt --from-file=key2=key2.txt

1 change: 1 addition & 0 deletions Ejemplos/Ejemplo08-Secrets/key1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Heidi
1 change: 1 addition & 0 deletions Ejemplos/Ejemplo08-Secrets/key2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pedro
6 changes: 6 additions & 0 deletions Ejemplos/Ejemplo08-Secrets/limpiarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

kubectl delete secret my-secret

kubectl delete secret my-second-secret

6 changes: 6 additions & 0 deletions Ejemplos/Ejemplo08-Secrets/mostrarSecrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

kubectl get secret my-secret -o yaml

kubectl get secret my-second-secret -o yaml

3 changes: 3 additions & 0 deletions Ejemplos/Ejemplo09-Namespaces/crearNamespace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

kubectl create namespace rrhh
4 changes: 4 additions & 0 deletions Ejemplos/Ejemplo09-Namespaces/crearPodEnNamespace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl run nginxrrhh --image=nginx --port 80 --namespace rrhh

3 changes: 3 additions & 0 deletions Ejemplos/Ejemplo09-Namespaces/limpiarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

kubectl delete namespace rrhh
4 changes: 4 additions & 0 deletions Ejemplos/Ejemplo09-Namespaces/mostrarPodsNamespace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl get pods --namespace rrhh

3 changes: 3 additions & 0 deletions Ejemplos/Ejemplo10-Escalado/escalar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

kubectl scale deployments jsonproducer --replicas=4
5 changes: 5 additions & 0 deletions Ejemplos/Ejemplo10-Escalado/lanzarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

kubectl run jsonproducer --image=ualmtorres/jsonproducer:v0 --port 80
kubectl expose deployment jsonproducer --type=NodePort
minikube service jsonproducer
4 changes: 4 additions & 0 deletions Ejemplos/Ejemplo10-Escalado/limpiarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl delete service jsonproducer
kubectl delete deployment jsonproducer
13 changes: 13 additions & 0 deletions Ejemplos/Ejemplo10-Escalado/mostrarInformacion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

echo "***"
echo "*** Listado de deployments"
echo "***"

kubectl get deployments

echo "***"
echo "*** Listado de pods"
echo "***"

kubectl get pods
3 changes: 3 additions & 0 deletions Ejemplos/Ejemplo10-Escalado/reducir.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

kubectl scale deployments jsonproducer --replicas=2
4 changes: 4 additions & 0 deletions Ejemplos/Ejemplo11-Actualizacion/actualizar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl set image deployments jsonproducer jsonproducer=ualmtorres/jsonproducer:v1
minikube service jsonproducer
5 changes: 5 additions & 0 deletions Ejemplos/Ejemplo11-Actualizacion/lanzarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

kubectl run jsonproducer --image=ualmtorres/jsonproducer:v0 --port 80
kubectl scale deployments jsonproducer --replicas=2
kubectl expose deployment jsonproducer --type=NodePort
4 changes: 4 additions & 0 deletions Ejemplos/Ejemplo11-Actualizacion/limpiarEntorno.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl delete service jsonproducer
kubectl delete deployment jsonproducer
13 changes: 13 additions & 0 deletions Ejemplos/Ejemplo11-Actualizacion/mostrarInformacion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

echo "***"
echo "*** Listado de deployments"
echo "***"

kubectl get deployments

echo "***"
echo "*** Listado de pods"
echo "***"

kubectl get pods
4 changes: 4 additions & 0 deletions Ejemplos/Ejemplo11-Actualizacion/rollback.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl rollout undo deployments jsonproducer
minikube service jsonproducer
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Curso de introducción a Kubernetes

Curso de introducción a Kubernetes que presenta de forma práctica los componentes principales y las operaciones más habituales

[Tutorial](https://ualmtorres.github.io/SeminarioKubernetes/)

[Slides (No disponibles aún)]()

Los ejemplos están disponibles en la carpeta [Ejemplos](https://github.com/ualmtorres/CursoKubernetes/tree/master/Ejemplos)

0 comments on commit 048d7f9

Please sign in to comment.