Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Cncf k8s_network_02

481 views

Published on

Kubernetes Pod 是有生命週期的,它們可以被創建,也可以被銷毀,然而一旦被銷毀生命就永遠結束。通過 ReplicaSets 能夠動態地創建和銷毀 Pod(例如,需要進行擴縮容,或者執行 滾動升級)。每個 Pod 都會獲取它自己的 IP 地址,即使這些 IP 地址不總是穩定可依賴的。這會導致一個問題:在 Kubernetes 集群中,如果一組 Pod(稱為 backend)為其它 Pod (稱為 frontend)提供服務,那麼那些 frontend 該如何發現,並連接到這組 Pod 中的哪些 backend 呢?

Kubernetes Service 定義了這樣一種抽象:邏輯上的一組 Pod,一種可以訪問它們的策略。這一組 Pod 能夠被 Service 訪問到,通常是通過 Label Selector實現的。

Published in: Technology
  • Be the first to comment

Cncf k8s_network_02

  1. 1. Cloud Native: Kubernetes Network Kubernetes Part#2 1
  2. 2. • 5 / • 3 MES/SFC • 3 ERP (SAP-MM )/EAI Leader • 2 End-To-End Business Integration Analyst • 1 OEM Sales Team Leader • 4 / • 6 / • IT – • 4.0 / - erhwenkuo@gmail.com 2
  3. 3. • ” ” • https://www.hwchiu.com/kubernetes-service-i.html
  4. 4. • , Kubernetes : • Part#1 - Kubernetes • Part#2 - Kubernetes Service Deployment Pod • Part#3 - Kubernetes I Ingress
  5. 5. • kubectl D SDK • T b O tT Provision r RBAC Quota PSP NetworkPolicy • e f s DNS g • Kubernetes h t K API i t n • t O Tt • Kubernetes u CI CD Workflow FaaS OTS ChatOps • Kubernetes CRI CNI CVI Cloud Provider t
  6. 6. Agenda 1. The basic knowledge of Kubernetes Service concept 2. Demo how Kubernetes Service works 3. Summary 6
  7. 7. • Part#1 : • Kubernetes N • Kubernetes pod pod • podN IP K
  8. 8. • kubernetes t t i e , i e t : • s , N t • , t IP • r kubernetes , (Pod) o IP K • t ni IP K , i t u wk ( b ) g IP K
  9. 9. • n t Kubernetes K i , PodiIP i i o : • PodiIP uik rIPi i • Podw , IP es g i , Kubernetesw iPod • bpodiIP is N • Kubernetes
  10. 10. • t r t • o (reverse-proxy load balancer) • n e N k e • • s K b g e g i
  11. 11. Kubernetes : • Kubernetes N K • Kubernetes N (Service) • (Service) N
  12. 12. Kubernetes “Service” 12
  13. 13. • Kubernets P e m s Deployment r l Web Server, database,monitor • : • MongoDB hs a o MongoDB tb • MongoDB mMongoDBW Pod Kubernetes
  14. 14. • MongoDB Pod, Pod IP
  15. 15. • App MongoDB MongoDB IP
  16. 16. • kubernetes Mongo pod pod • pod IP P , • 6 1 IP ? ?
  17. 17. • IP • • 1 • 1 DNS
  18. 18. • H Kuberntes Service • Kuberntes Service IP
  19. 19. • Kubernetes Service w S 1. Service v T Mongo pods Kubernetes service v TMongo pod IP 2. Service H FQDN T o App FQDN Mongo pod App e FQDN l T Mongo pod Service
  20. 20. • Kubernetes Service T kubernetes e H S ( re-try ) 1. Mongo H e( Pod ) 2. Kubernetes Service e Service Mongo H 3. S S (2) kubernetes service FQDN
  21. 21. - • P b e i n g IP • Kubernetes Service Types pb s : • ClusterIP (r ) • NodePort • LoadBalancer • ExternalName • c b ClusterIP NodePort l hb
  22. 22. • ClusterIP I / c FQDN S • CT c kubernetes e i c FQDN P kubernetes dns : IP
  23. 23. • NodePort P ClusterIP / Nc • : T d NodePort i (S e kubernetes
  24. 24. • kubernetes service FQDN H • e H ? • o NodePort lH v Port H • LoadBalancer T H S , cloud provider LoadBalancer ,
  25. 25. • ClusterIP NodePort
  26. 26. P K8S App b HostApp b • ClusterIP: b • NodePort: a W b kubernetes b
  27. 27. Kubernetes “Service” 27
  28. 28. • kubeDemo ClusterIP NodePort • https://github.com/hwchiu/kubeDemo
  29. 29. • Nginx ubuntu I H Service Nginx
  30. 30. • Ngnix $ kubectl create -f https://raw.githubusercontent.com/hwchiu/kubeDemo/master/services/deployment/nginx.yml
  31. 31. • ubuntu $ kubectl create -f https://raw.githubusercontent.com/hwchiu/kubeDemo/master/services/application/ubuntu.yml
  32. 32. • Cluster-IP $ kubectl create -f https://raw.githubusercontent.com/hwchiu/kubeDemo/master/services/service/nginx- cluster.yml
  33. 33. • I H services/service/nginx-cluster.yml 1. Type, ClusterIP 2. service selector k8s- nginx nginx TCP:80 3. service k8s-nginx-cluster
  34. 34. • kubectl describe service • Name Namespace H service I $Name.$Namespace I FQDN I I • k8s-nginx-cluster.default
  35. 35. • Ubuntu NGINX •
  36. 36. • ( I ) ? • FQDN DNS H
  37. 37. • NodePort $ kubectl create -f https://raw.githubusercontent.com/hwchiu/kubeDemo/master/services/service/nginx-node.yml
  38. 38. • services/service/nginx-node.yml 1. Type NodePort 2. service k8s-nginx-node
  39. 39. • kubectl describe service • H U Name/Namespace NodePort I 31826 TCP:31826 T Nginx
  40. 40. • localhost:31826
  41. 41. • Kubernetes Service, Service Service • ClusterIP NodePort • ClusterIP/NodePort S service Kubernetes
  42. 42. • 82 ? ? ?K9 7 1K 5? NC ? P • IK C H D ? ? ?K K? NC ? C • H /H?K 6 ? 2 ? ? ?K ? H DC 7H D • IK ? C H - H: ( H H?K ? D ? ? ?K ? H DC H D I ?) @ @@ @ • 2 ? ? ?K .H ?I 5? NC ?K • IK D ? ? ?K CH H K H ?I K K? NC ?K ? H DC K? NC ?
  43. 43. 43 https://www.facebook.com/groups/dataengineering.tw/

×