Diferències
Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.
Ambdós costats versió prèvia Revisió prèvia Següent revisió | Revisió prèvia | ||
info:cursos:pue:devops:sesion8 [10/03/2019 03:45] – [otros] mate | info:cursos:pue:devops:sesion8 [08/04/2020 06:57] (actual) – [Sesión 8 : kubernetes] mate | ||
---|---|---|---|
Línia 1: | Línia 1: | ||
= Sesión 8 : kubernetes | = Sesión 8 : kubernetes | ||
+ | {{tag> | ||
== katacoda | == katacoda | ||
* [[https:// | * [[https:// | ||
Línia 65: | Línia 66: | ||
* istio | * istio | ||
* kong = capa + plugin ram lua + nginx | * kong = capa + plugin ram lua + nginx | ||
- | * katacoda | + | |
- | * [[https:// | + | === katacoda |
- | * '' | + | ==== lab1 |
- | * '' | + | |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * [[https:// | + | * '' |
- | * kubeadm : aprovisionamiento de nodos | + | * '' |
- | * '' | + | |
- | * '' | + | ==== lab2 |
- | * '' | + | |
- | * '' | + | * kubeadm : aprovisionamiento de nodos |
- | * **--discovery-token-unsafe-skip-ca-verification** : bybass Discovery Token verification | + | * '' |
- | * '' | + | * '' |
- | * CNI: Container Network Interface : [[https:// | + | * '' |
- | * '' | + | * '' |
- | * [[https:// | + | * **--discovery-token-unsafe-skip-ca-verification** : bybass Discovery Token verification |
- | * '' | + | * '' |
- | * '' | + | * CNI: Container Network Interface : [[https:// |
- | * '' | + | * '' |
- | * '' | + | * [[https:// |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * Creacion **ServiceAccount**:< | + | * '' |
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * Creacion **ServiceAccount**:< | ||
apiVersion: v1 | apiVersion: v1 | ||
kind: ServiceAccount | kind: ServiceAccount | ||
Línia 112: | Línia 117: | ||
namespace: kube-system | namespace: kube-system | ||
EOF</ | EOF</ | ||
- | | + | |
- | * '' | + | * '' |
- | * [[https:// | + | |
- | * '' | + | ==== lab3 |
- | * '' | + | |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * en un solo comando: '' | + | * '' |
- | * escalar contenedores: | + | * '' |
- | * '' | + | * en un solo comando: '' |
- | * cada nuevo pod creado se añade al LB | + | * escalar contenedores: |
- | * '' | + | * '' |
- | * '' | + | * cada nuevo pod creado se añade al LB |
- | * [[https:// | + | * '' |
- | * <code yaml; deployment.yaml> | + | * '' |
+ | |||
+ | ==== lab4 | ||
+ | | ||
+ | * <code yaml; deployment.yaml> | ||
kind: Deployment | kind: Deployment | ||
metadata: | metadata: | ||
Línia 144: | Línia 153: | ||
ports: | ports: | ||
- containerPort: | - containerPort: | ||
- | * '' | + | * '' |
- | | + | |
- | | + | |
- | | + | |
kind: Service | kind: Service | ||
metadata: | metadata: | ||
Línia 160: | Línia 169: | ||
selector: | selector: | ||
app: webapp1</ | app: webapp1</ | ||
- | * '' | + | * '' |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
+ | ==== lab5 | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * arrancan un cluster k8s con 1 master y 1 nodo: | ||
+ | * API | ||
+ | * Master | ||
+ | * Proxy | ||
+ | * DNS | ||
+ | * k8s service deployment: | ||
+ | * replication controller: cuantas instancias, la imagen docker a usar, el nombre que lo identifica (más otras de configuración y discovery) | ||
+ | * '' | ||
+ | * <code yaml; redis-master-controller.yaml> | ||
+ | kind: ReplicationController | ||
+ | metadata: | ||
+ | name: redis-master | ||
+ | labels: | ||
+ | name: redis-master | ||
+ | spec: | ||
+ | replicas: 1 | ||
+ | selector: | ||
+ | name: redis-master | ||
+ | template: | ||
+ | metadata: | ||
+ | labels: | ||
+ | name: redis-master | ||
+ | spec: | ||
+ | containers: | ||
+ | - name: master | ||
+ | image: redis: | ||
+ | ports: | ||
+ | - containerPort: | ||
+ | * service: | ||
+ | * load balancer que reenvia el tráfico a 1 o más contenedores (aunque estén en nodos diferentes) | ||
+ | * comunica dentro del clustes, rara vez expone puertos al exterior | ||
+ | * para comunicarnos desde fuera del cluster se recomienda el uso de un LoadBalancer | ||
+ | * '' | ||
+ | * <code yaml; redis-master-service.yaml> | ||
+ | kind: Service | ||
+ | metadata: | ||
+ | name: redis-master | ||
+ | labels: | ||
+ | name: redis-master | ||
+ | spec: | ||
+ | ports: | ||
+ | # the port that this service should serve on | ||
+ | - port: 6379 | ||
+ | targetPort: 6379 | ||
+ | selector: | ||
+ | name: redis-master</ | ||
+ | * '' | ||
+ | * '' | ||
+ | * replication slave pods | ||
+ | * [[http:// | ||
+ | * uso de variables de entorno para el descubrimiento de otros PODs | ||
+ | * '' | ||
+ | * <code yaml; redis-slave-controller.yaml> | ||
+ | kind: ReplicationController | ||
+ | metadata: | ||
+ | name: redis-slave | ||
+ | labels: | ||
+ | name: redis-slave | ||
+ | spec: | ||
+ | replicas: 2 | ||
+ | selector: | ||
+ | name: redis-slave | ||
+ | template: | ||
+ | metadata: | ||
+ | labels: | ||
+ | name: redis-slave | ||
+ | spec: | ||
+ | containers: | ||
+ | - name: worker | ||
+ | image: gcr.io/ | ||
+ | env: | ||
+ | - name: GET_HOSTS_FROM | ||
+ | value: dns | ||
+ | # If your cluster config does not include a dns service, then to | ||
+ | # instead access an environment variable to find the master | ||
+ | # service' | ||
+ | # uncomment the line below. | ||
+ | # value: env | ||
+ | ports: | ||
+ | - containerPort: | ||
+ | * '' | ||
+ | * service redis slaves | ||
+ | * '' | ||
+ | * <code yaml; redis-slave-service.yaml> | ||
+ | kind: Service | ||
+ | metadata: | ||
+ | name: redis-slave | ||
+ | labels: | ||
+ | name: redis-slave | ||
+ | spec: | ||
+ | ports: | ||
+ | # the port that this service should serve on | ||
+ | - port: 6379 | ||
+ | selector: | ||
+ | name: redis-slave</ | ||
+ | * '' | ||
+ | * **PQ NO TIENE UN TARGETPORT COMO EL REDIS-MASTER-SERVICE.YAML** | ||
+ | * deploy de la web app | ||
+ | * '' | ||
+ | * <code yaml; frontend-controller.yaml> | ||
+ | kind: ReplicationController | ||
+ | metadata: | ||
+ | name: frontend | ||
+ | labels: | ||
+ | name: frontend | ||
+ | spec: | ||
+ | replicas: 3 | ||
+ | selector: | ||
+ | name: frontend | ||
+ | template: | ||
+ | metadata: | ||
+ | labels: | ||
+ | name: frontend | ||
+ | spec: | ||
+ | containers: | ||
+ | - name: php-redis | ||
+ | image: gcr.io/ | ||
+ | env: | ||
+ | - name: GET_HOSTS_FROM | ||
+ | value: dns | ||
+ | # If your cluster config does not include a dns service, then to | ||
+ | # instead access environment variables to find service host | ||
+ | # info, comment out the ' | ||
+ | # line below. | ||
+ | # value: env | ||
+ | ports: | ||
+ | - containerPort: | ||
+ | * '' | ||
+ | * '' | ||
+ | * hacemos accesible el frontend | ||
+ | * NodePort: expone un puerto | ||
+ | * '' | ||
+ | * <code yaml; frontend-service.yaml> | ||
+ | kind: Service | ||
+ | metadata: | ||
+ | name: frontend | ||
+ | labels: | ||
+ | name: frontend | ||
+ | spec: | ||
+ | # if your cluster supports it, uncomment the following to automatically create | ||
+ | # an external load-balanced IP for the frontend service. | ||
+ | # type: LoadBalancer | ||
+ | type: NodePort | ||
+ | ports: | ||
+ | # the port that this service should serve on | ||
+ | - port: 80 | ||
+ | nodePort: 30080 | ||
+ | selector: | ||
+ | name: frontend</ | ||
+ | * '' | ||
+ | * estado de los pods: '' | ||
+ | * por si no hemos asignado el puerto y queremos ver cual ha sido asignado: '' | ||
== otros | == otros | ||
* abreviaturas: | * abreviaturas: |