O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Docker Summit 2016 - Kubernetes: Sweets and Bitters

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Carregando em…3
×

Confira estes a seguir

1 de 36 Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Semelhante a Docker Summit 2016 - Kubernetes: Sweets and Bitters (20)

Anúncio

Mais de smalltown (19)

Mais recentes (20)

Anúncio

Docker Summit 2016 - Kubernetes: Sweets and Bitters

  1. 1. Kubernetes : Sweets and Bitters Come On Docker ❤ 吉你
  2. 2. Hello! I am Tom Tsai I am here because I want to give life to the servers ▷ Startup (DevOps) ▷ Trend Micro (QA, DevOps) ▷ DevOps Lecturer
  3. 3. “Have You Organization Adopted Any Container Orchestration ?
  4. 4. Outline ▷ Kubernetes Introduction ▷ Access Kubernetes API ▷ Kubernetes CI/CD Pipeline ▷ Container High Availability ▷ Kubernetes Misc ▷ Q & A
  5. 5. 1. Kubernetes Introduction
  6. 6. Without Kubernetes
  7. 7. With Kubernetes
  8. 8. K8S Infra
  9. 9. Kubernetes Terminology Pod A group of one or more containers Replica Set Ensures that a specified number of pod “replicas” are running Deployment Provides declarative updates for Pods and Replica Sets Service a logical set of Pods and a policy by which to access them
  10. 10. Deployment Replica Set Pod Container 1 Container 2 Replica Set Pod Container 1 Container 2 Service
  11. 11. 2. Access Kubernetes API
  12. 12. Access Kubernetes API
  13. 13. User Account V.S. Service Account Service Account User Account
  14. 14. Authorization Mode ▷ AlwaysDeny, AlwaysAllow, ABAC ▷ ABAC Mode ○ user, readonly, resource, namespace ○ {"user":"bob", "resource": "pods", "readonly": true, "ns": "projectCaribou"}
  15. 15. Real Practice Alpha (readonly) Staging (readonly) Prod (readonly) Jenkins False False False Human False True True
  16. 16. Kubectl V.S. Restful API ~$ kubectl delete deployment nginx DELETE /apis/extensions/v1beta1/namespaces/default/deployments/nginx
  17. 17. Kubectl V.S. Restful API ~$ kubectl delete deployment nginx DELETE /apis/extensions/v1beta1/namespaces/default/deployments/nginx deployment, replica set, pod are deleted from K8S only deployment is deleted from K8S
  18. 18. 3. Kubernetes CI/CD Pipeline
  19. 19. Jenkins Integrate With Kubernetes 1. Create Deployment 2. Update Image ver. 3. Create Service 4. Of course, Testing K8S Restful API
  20. 20. Actually Happened… (1/3) Using Template Language to create Deployment, Service YAML File - Chef: ERB - Ansible: Jinja2 ... containers: - name: nginx image: "10.1.1.1:500/web/nginx:{{ image_tag }}" ...
  21. 21. Actually Happened…(2/3) HTTP POST (Reference) /api/v1/namespaces/{namespace}/services/{name} /apis/extensions/v1beta1/namespaces/{namespace}/deploy ments/{name}
  22. 22. Actually Happened…(3/3) HTTP PATCH (Reference) /api/v1/namespaces/{namespace}/services/{name} /apis/extensions/v1beta1/namespaces/{namespace}/deploy ments/{name}
  23. 23. 4. Container High Availability
  24. 24. Container Alive V.S. Service Alive ▷ Container Alive != Service Alive ▷ When Container Dead, Restarting Pod Automatically ▷ When Service Dead ?
  25. 25. Liveness Probes ▷ Check Whether Service Alive Or Not ▷ Restart Pod If Service Unavailable ▷ Exec Liveness ▷ Http Liveness
  26. 26. Readiness Probes ▷ Check Whether Service Alive Or Not ▷ Bind Pod If Service Ready ▷ Unbind Pod If Service Unavailable ▷ Exec Liveness ▷ Http Liveness
  27. 27. Termination Notice ▷ Grace Terminate Container ▷ Send SIGTERM to applications ▷ pre-stop lifecycle hook
  28. 28. 5. Kubernetes Misc
  29. 29. Daemon Set ▷ Daemon Set ensures that all (or some) nodes run a copy of a pod ▷ Rolling Update Issue
  30. 30. Deploy Daemon Set Workaround ▷ Replace Instead Of Rolling Update ▷ Deployment + hostPort Instead Of Daemon Set ports: - containerPort: 9999 name: for-deployment hostPort: {{ 2000 |random(start=1000, step=10) }}
  31. 31. Troubleshooting ▷ Official Support Document ○ ~$ kubectl get {resource_type} | grep {name} ○ ~$ kubectl logs {pod_name} ○ ~$ kubectl describe {resource_type} {name} ○ ~$ kubectl edit {resource_type} {name} ○ ~$ kubectl exec -it {pod_name} bash
  32. 32. Update V.S. Replace ▷ Rolling Update K8S Resource First, Reduce Service Downtime ▷ Increase terminationGracePeriodSeconds if needed ▷ But It’s Necessary To Replace Resource Sometimes...
  33. 33. Capability Unfortunately, I annot disclose these details. 你 Pod 數有多高 ? Pod Number Container Per Pod 100 10 10 100 Which Loading Is Higher?
  34. 34. Access K8S From External NodePort Where Pod?
  35. 35. Access K8S From External Service IP Pod IP Directly
  36. 36. Thanks! Any questions? You can find me at: smalltown20110306 smalltown0110 smalltown0110

×