Anúncio
Anúncio

Mais conteúdo relacionado

Apresentações para você(20)

Similar a Kubernetes in 30 minutes (2017/03/10)(20)

Anúncio
Anúncio

Kubernetes in 30 minutes (2017/03/10)

  1. Kubernetes in 30 minutes Mar 10, 2017 Daisuke Maki @lestrrat
  2. Netscape Navigator
  3. Netscape Navigator
  4. Kubernetes
  5. κυβερνήτης
  6. k8s
  7. “Something to do with containers…?
  8. •You know about containers •You know about orchestration •You know about the painful art of deploying stuff Assumptions
  9. Docker
  10. “Random containers doing their own sh*t”
  11. Compose
  12. “Foreman on Acid”
  13. Swarm
  14. “Clustering and Discovery” (hey, we’re getting somewhere!)
  15. =
  16. “Batteries Included”
  17. K8s on GCP GKE GCE Networking …and others
  18. Basic Concepts
  19. Node
  20. Hosts running k8s daemons
  21. Node kubelet Node kubelet Node kubelet Master Scheduler etc.. API
  22. Pod
  23. Basic unit of deployment in k8s 基本
  24. Group of Containers
  25. Container configurations
  26. Shared storage
  27. Pod container
  28. Pod container container
  29. Pod container container container
  30. Pod container container container nginx app redis/cache e.g.
  31. Scheduled together (“co-scheduled”)
  32. Guaranteed to be on the same node (“co-located”)
  33. Node NodeNode
  34. Node NodeNode Depends on each node’s resource availability and each pod’s resource requirements
  35. Node Node container container container
  36. Node Node container container container This will NEVER happen
  37. Miscellaneous • Each pod has its own IP address • Pods are expected to be stateless
  38. Replica Set
  39. Keeps track of Pod replicas
  40. Replica Set replicas: 3
 template:
  41. Replica Set replicas: 3
 template: A
  42. Replica Set replicas: 3
 template: A B
  43. Replica Set replicas: 3
 template: CA B
  44. Replica Set replicas: 3
 template: CA B
  45. Replica Set replicas: 3
 template: A B
  46. Replica Set replicas: 3
 template: A B D
  47. Deployment
  48. Manages Replica Set state transitions
  49. Deployment replicas: 3
 template:
  50. Deployment replicas: 3
 template: Replica Set A replicas: 3
 template:
  51. Deployment replicas: 3
 template: Replica Set A replicas: 3
 template: Change some settings, please!
  52. Deployment replicas: 3
 template: Replica Set A replicas: 3
 template: 2 Change some settings, please!
  53. Deployment replicas: 3
 template: Replica Set A replicas: 3
 template: Replica Set B replicas: 2
 template: 2 Change some settings, please!
  54. Deployment replicas: 3
 template: Replica Set A replicas: 3
 template: Replica Set B replicas: 2
 template: 2 Change some settings, please!
  55. Deployment replicas: 3
 template: Replica Set B replicas: 2
 template: 2 Change some settings, please!
  56. Keeps track of state change history
  57. Deployment replicas: 3
 template:
  58. Deployment replicas: 3
 template: A replicas: 3
 template:
  59. Deployment replicas: 3
 template: A replicas: 3
 template: Change some settings, please!
  60. Deployment replicas: 3
 template: A replicas: 3
 template: 2 Change some settings, please!
  61. Deployment replicas: 3
 template: A replicas: 3
 template: B replicas: 2
 template: 2 Change some settings, please!
  62. Deployment replicas: 3
 template: A replicas: 3
 template: B replicas: 2
 template: 2 Change some settings, please!
  63. Deployment replicas: 3
 template: B replicas: 2
 template: 2 Change some settings, please!
  64. Deployment replicas: 3
 template: B replicas: 2
 template: 2 Oh wait, I actually didn’t want to do that…
  65. Deployment replicas: 3
 template: B replicas: 2
 template: 2 Oh wait, I actually didn’t want to do that… 3
  66. Deployment replicas: 3
 template: B replicas: 2
 template: 2 Oh wait, I actually didn’t want to do that… rollback 3
  67. Deployment replicas: 3
 template: B replicas: 2
 template: 2 Oh wait, I actually didn’t want to do that… rollback A replicas: 3
 template: 3
  68. Deployment replicas: 3
 template: B replicas: 2
 template: 2 Oh wait, I actually didn’t want to do that… rollback A replicas: 3
 template: 3
  69. Deployment replicas: 3
 template: 2 Oh wait, I actually didn’t want to do that… A replicas: 3
 template: 3
  70. Services
  71. Logical set of Pods (and ways to access them)
  72. Pod 10.0.96.2 Pod 10.0.96.3 Pod 10.0.96.3 Raw Pod Access
  73. Pod 10.0.96.2 Pod 10.0.96.3 Pod 10.0.96.3 Raw Pod Access
  74. Pod 10.0.96.2 Pod 10.0.96.3 Pod 10.0.96.3 Raw Pod Access
  75. Pod 10.0.96.2 Pod 10.0.96.3 Raw Pod Access
  76. Pod 10.0.96.2 Pod 10.0.96.3 Raw Pod Access
  77. Pod 10.0.96.3 role=web Access Via Service Pod 10.0.96.4 role=web Service match role=web Pod 10.0.96.2 role=web Pod 10.0.96.5 role=db
  78. Pod 10.0.96.3 role=web Access Via Service Pod 10.0.96.4 role=web Service match role=web Pod 10.0.96.2 role=web Pod 10.0.96.5 role=db
  79. Pod 10.0.96.3 role=web Access Via Service Pod 10.0.96.4 role=web Service match role=web Pod 10.0.96.2 role=web Pod 10.0.96.5 role=db
  80. Pod 10.0.96.3 role=web Access Via Service Pod 10.0.96.4 role=web Service match role=web Pod 10.0.96.2 role=web Pod 10.0.96.5 role=db
  81. Access Via Service Pod 10.0.96.4 role=web Service match role=web Pod 10.0.96.2 role=web Pod 10.0.96.5 role=db
  82. Access Via Service Pod 10.0.96.4 role=web Service match role=web Pod 10.0.96.2 role=web Pod 10.0.96.5 role=db
  83. Access Via Service Pod 10.0.96.6 role=web Pod 10.0.96.4 role=web Service match role=web Pod 10.0.96.2 role=web Pod 10.0.96.5 role=db
  84. Access Via Service Pod 10.0.96.6 role=web Pod 10.0.96.4 role=web Service match role=web Pod 10.0.96.2 role=web Pod 10.0.96.5 role=db
  85. Secrets
  86. Store pieces of data in k8s
  87. e.g. Identity Information
  88. (securely)
  89. (…in the future)
  90. Secret key1 → base64 value key3 → base64 value key2 → base64 value
  91. Pod container volumes container:
 volumeMounts: - name: certificates mountPath: /etc/ssl/certs volumes: - name: certificates secret: secretName: ca-certificates
  92. Pod container volumes env: - name: foo-secret valueFrom: secretKeyRef: name: foo value: secret-value
  93. ConfigMaps
  94. Same as Secrets (Unprotected)
  95. Ingress
  96. Services are for within the cluster only (external IPs allowed, but don’ use that to serve external requests)
  97. (New since 1.2) Inbound connections to internal cluster services
  98. Please checkout my presentation https://docs.google.com/presentation/d/ 11ZN6qgiuZZfVyhBK2hjp1vhp_5N0DOGnAmhPreS3L5A/pub? start=false&loop=false&delayms=3000
  99. DaemonSets
  100. Ensure nodes run a copy of a Pod Node prometheus-exporter prometheus-exporter prometheus-exporter Node Node
  101. PetSets
  102. PetSets StatefulSets
  103. Use only when *really* needed
  104. Keeps unique IDs in replicas (x-0, x-1, x-2,…)
  105. Questions?
Anúncio