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.
Kubernetes trong triển khai ứng
dụng web
Nguyen Xuan Phong
Agenda
 Giới thiệu
 Nhắc lại về Docker
 Giới thiệu Kubernetes
 Kiến trúc Kubernetes
 Các thành phần cơ bản trong Kube...
$ NGUYEN XUAN PHONG
$
$ DevOps – Branch Manager at GMO Zcom
VietNam Lab Center
$
$ Web - - - - - - - - - - - - - - - - - -...
https://point.gmo.jp/
Agenda
 Giới thiệu
 Nhắc lại về Docker
 Giới thiệu Kubernetes
 Kiến trúc Kubernetes
 Các thành phần cơ bản trong Kube...
Vấn đề trong triển khai hệ thống
phần mềm
m n
Giải pháp triển khai hệ thống
phần mềm
m
Docker xuất hiện mở ra cuộc cách
mạng về ảo hoá
So sánh với các HyperVisor
HyperVisor Type 2 Docker
Virtualization Type Vitualization Machine Container
Weight of the created virtual
systems
Heavy V...
Kiến trúc Docker
Nginx
Php - fpm
Mysql
Docker
Container
Simple web app
Các vấn đề liên quan đến triển khai
hệ thống sử dụng docker
Health Discovery Scheduling
Configuration
Scaling Security
The...
Agenda
 Bối cảnh
 Nhắc lại về Docker
 Giới thiệu Kubernetes
 Kiến trúc Kubernetes
 Các thành phần cơ bản trong Kubern...
κυβερνήτης
k8s
Kubernetes
 Manage application, not machine
 Kubernetes là một Platform tự động hoá việc
quản lý, scaling container
 Ku...
=
Kubernetes vs Docker Swarm
https://platform9.com/blog/kubernetes-docker-swarm-compared/
Kubernetes làm được những gì
 Việc quản lý hàng loạt docket host
 Container Scheduling
 Rolling update
 Scaling/Auto S...
Kubernetes liên kết với hệ sinh
thái
 Ansible: Deploy container tới Kubernetes
 Apache Ignite: Sử dụng Service Discovery...
Các môi trường Kubernetes
 Local Kubermetes
 Công cụ hỗ trợ thiết lập môi trường Kubernetes
 Quản lý Kubernetes trên pu...
Local Kubermetes
Minikube
Docker for Mac
Công cụ hỗ trợ thiết lập môi trường
Kubernetes
 kubeadm
 Rancher
Quản lý Kubernetes trên public
cloud
 Google Kubernetes Engine(GKE)
 Azure Container Service(AKS)
 Elastic Container Se...
GKE(Google Kubernetes Engine)
Agenda
 Giới thiệu
 Nhắc lại về Docker
 Giới thiệu Kubernetes
 Kiến trúc Kubernetes
 Các thành phần cơ bản trong Kube...
Agenda
 Giới thiệu
 Nhắc lại về Docker
 Giới thiệu Kubernetes
 Kiến trúc Kubernetes
 Các thành phần cơ bản trong Kube...
Node
Hosts running
k8s daemons
Node Node Node
Master
API
Scheduler
etc..
kubelet kubelet kubelet
Kubernetes Resource
Phân Loại Resource Mô tả
Workloads Resource liên quan đến thực thi container
Discovery&Load balancer R...
Workloads
Pod
ReplicationController
ReplicaSet
Deployment
DaemonSet
StatefulSet
Job
CronJob
Discovery&LB resource
Service
...
Workloads
Pod
ReplicationController
ReplicaSet
Deployment
DaemonSet
StatefulSet
Job
CronJob
Discovery&LB resource
Service
...
Workloads
Pod
ReplicationController
ReplicaSet
Deployment
DaemonSet
StatefulSet
Job
CronJob
Discovery&LB resource
Service
...
Pod
Basic unit of
deployment in k8s
Group of container
Container configuration
Shared storage
Pod
container
container
container
Volume
NIC
Pod
container
container
container
nginx
frontend app
redis/cache
e.g.
Scheduled together
Guaranteed to be on
the same node
container
container
container
container
container
container
container
container
container
Node Node Node
Pod Pod Pod
container
container
container
container
container
container
Node 1 Node 2 Node 3
Pod Pod
container
container
container
Pod...
container
container
container
Node Node
container
container
container
Node Node
This will NEVER happen
MasterAPI
UI
CLI
Node 1
Node 2
Node 3
Pod
Pod
Node
MasterAPI
UI
CLI
Node 1
Node 2
Node 3
Pod
=
Demo Pod
ReplicaSet
Keep track of
Pod replicas
Replica Set
replica: 3
template:
container
container
container
Pod A
container
container
container
Pod
Replica Set
replica: 3
template:
container
container
container
Pod B
container
container
container
Pod A
container
contain...
Replica Set
replica: 3
template:
container
container
container
Pod B
container
container
container
Pod A
container
contain...
Replica Set
container
container
container
Podreplica: 3
template:
container
container
container
Pod B
container
container
...
Replica Set
replica: 3
template:
container
container
container
Pod B
container
container
container
Pod A
container
contain...
Auto healing
Deployment
Manages Replicas Set
state transitions
Deployment
container
container
container
Podreplica: 3
template:
Deployment
ReplicaSet A
container
container
container
Pod
replica: 3
template:
container
container
container
Podreplica: 3...
Deployment
ReplicaSet A
containe
r
containe
r
containe
r
Pod
replica: 3
template:
Change some setting,
please!
container
c...
Deployment
ReplicaSet A
Change some setting,
please!
replica: 3
template:
container
container
container
Podreplica: 3
temp...
Deployment
ReplicaSet A
Change some setting,
please!
ReplicaSet B
replica: 3
template:
container
container
container
Podre...
Deployment
ReplicaSet A
Change some setting,
please!
ReplicaSet B
replica: 3
template:
container
container
container
Podre...
Deployment
ReplicaSet B
replica: 3
template:
container
container
container
Podreplica: 3
template:
container
container
con...
Keep track of state
change history
Deployme
nt
ReplicaSet B
replica: 3
template:
container
container
container
Pod
replica: 3
template:
container
container
c...
Deployment
Oh wait, I actually
didn’t want to do that
ReplicaSet B
replica: 3
template:
container
container
container
Pod
...
Deployment
Oh wait, I actually
didn’t want to do that
ReplicaSet B
Rollback
container
container
container
Pod
replica: 3
t...
Deployment
ReplicaSet A ReplicaSet B
Oh wait, I actually
didn’t want to do that
Rollback
container
container
container
Pod...
Deployment
ReplicaSet A ReplicaSet B
Oh wait, I actually
didn’t want to do that
Rollback
container
container
container
Pod...
Deployment
ReplicaSet A
container
container
container
Podreplica: 3
template:
container
container
container
Pod
replica: 3...
Rolling update
Pod
DaemonSet
DaemonSet: Schedule Pod một cách tuần tự
từng Pod một trên tất cả các Node.
 Use case
 Fluentd: Collect logs tool
 Data...
Job
Job = Pod + batch = env + batch
 Job
 Start Pod (container
centos)
 Run command: sleep
60;
 Finish
 restartPolicy
 OnFailure: Use this Pod to run job
again
 Never: Create new Pod if Pod had
problem and run job
 completions: 1
 Job success one time and finish
 parallelism: 1
 run parallelism 1 pod
 backoffLimit: 10
 Allows fa...
Run job one time
CronJob
Cronjob = Job + schedule
Crontab = batch + schedule
Cronjob = Job + schedule
1
2
3
Cronjob = Job + schedule
 schedule
 same cron format
 http://www.nncron.ru/help/EN/working/cron
-format.htm
 Setting
...
Cronjob = Job + schedule
 schedule
 Setting
 startingDeadlineSeconds
 Thời gian trễ cho phép để run job
 successfulJo...
K8s Cronjob vs cron job in linux
Problem in cron job in linux
Job
Problem in cron job in linux
Job
That’s OK ???
Job
Solution with K8s Cronjob
Job
Node 1 Node 2
Solution with K8s Cronjob
Job
Node 1 Node 2
Solusion with K8s Cronjob
Node 1 Node 2
Job
Workloads
Pod
ReplicationController
ReplicaSet
Deployment
DaemonSet
StatefulSet
Job
CronJob
Discovery&LB resource
Service
...
Workloads
Pod
ReplicationController
ReplicaSet
Deployment
DaemonSet
StatefulSet
Job
CronJob
Discovery&LB resource
Service
...
Kubernetes network
ClusterIP
ClusterIP Service
:80 :80 :80
ExternalIP
:80 :80 :80
ExtenalIP Service
NodePort
:80 :80 :80
NodePort Service
:80 :80 :80
NodePort Service
NodePort Service
NodePort Service
LoadBalancer
Load Balancer Service
LoadBalancer support for
GKE AKS
Loadbalancer for
my K8s ???
https://www.weave.works/blog/kubernetes-faq-how-
can-i-route-traffic-for-kubernetes-on-bare-me...
MetalLB
https://metallb.universe.tf/
Workloads
Pod
ReplicationController
ReplicaSet
Deployment
DaemonSet
StatefulSet
Job
CronJob
Discovery&LB resource
Service
...
Agenda
 Bối cảnh
 Nhắc lại về Docker
 Giới thiệu Kubernetes
 Kiến trúc Kubernetes
 Các thành phần cơ bản trong Kubern...
Rancher is redesigned to work on
Kubernetes.
Rancher 2.0
Agenda
 Bối cảnh
 Nhắc lại về Docker
 Giới thiệu Kubernetes
 Kiến trúc Kubernetes
 Các thành phần cơ bản trong Kubern...
Docker registry
Docker registry
Docker registry
Kiến trúc Harbor
Kiến trúc Harbor
MasterAPICLI
MasterAPICLI
Kube-demo
CLI
Push
images
MasterAPICLI
Kube-demo
code-pvc
2G
nginx-config-
pvc
1G
CLI
MasterAPICLI
Kube-demo
code-pvc
2G
CLInginx-config-
pvc
1G
MasterAPICLI
Kube-demo
code-pvc
2G
CLI
Pull
images
nginx-config-
pvc
1G
MasterAPICLI
Pull
images
NIC
NIC
code-pvc
2G
NodePort *:32253
Pod
(nginx, php-fpm)
Volume
Kube-demo
nginx-config-
pvc
1G
DB
MasterAPICLI
Pull
images
NIC
NIC
code-pvc
2G
NodePort *:32253
Pod
(nginx, php-fpm)
Volume
Kube-demo
nginx-config-
pvc
1G
D...
MasterAPICLI
Pull
images
NIC
NIC
code-pvc
2G
NodePort *:32253
Pod
Volume
Kube-demo
nginx-config-
pvc
1G
DB
Frontend
Backend
MasterAPICLI
Pull
images
NIC
NIC
NodePort *:32253
Images
code-pvc
2G
nginx-config-
pvc
1G
DB
Frontend
Backend
Pod
Volume
N...
MasterAPICLI
Pull
images
NIC
NIC
NodePort *:32253
Images
code-pvc
2G
nginx-config-
pvc
1G
DB
Frontend
Backend
Pod
Volume
N...
Workloads
Pod
ReplicationController
ReplicaSet
Deployment
DaemonSet
StatefulSet
Job
CronJob
Discovery&LB resource
Service
...
Kubernetes For Beginner
Docker Docker-compose K8s
Tài Liệu Tham Khảo
 https://kubernetes.io/docs/tutorials/
 Serial blog kubernetes
 https://blog.vietnamlab.vn/2018/09/2...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam...
You’ve finished this document.
Upcoming SlideShare
What to Upload to SlideShare
Next
Upcoming SlideShare
What to Upload to SlideShare
Next

Share

[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam Lab Center

Kubernetes is a platform used to automate the management, to scale and to deploy applications in the form of containers. Kubernetes is also called Container orchestration engine.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong, DevOps - Branch Manager at GMO Zcom VietNam Lab Center

  1. 1. Kubernetes trong triển khai ứng dụng web Nguyen Xuan Phong
  2. 2. Agenda  Giới thiệu  Nhắc lại về Docker  Giới thiệu Kubernetes  Kiến trúc Kubernetes  Các thành phần cơ bản trong Kubernetes  Rancher 2.0  Harbor – Docker registry  Demo
  3. 3. $ NGUYEN XUAN PHONG $ $ DevOps – Branch Manager at GMO Zcom VietNam Lab Center $ $ Web - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $ Php $ Java $ Javascript $ $ Operation - - - - - - - - - - - - - - - - - - - - - - - - - $ Linux $ Vagrant $ Ansible $ Docker $ Kubernetes $ $ BrSE - - - - - - - - -- - - - - - - - - - - - - - - -- - - - $ Japanese N2
  4. 4. https://point.gmo.jp/
  5. 5. Agenda  Giới thiệu  Nhắc lại về Docker  Giới thiệu Kubernetes  Kiến trúc Kubernetes  Các thành phần cơ bản trong Kubernetes  Rancher 2.0  Harbor – Docker registry  Demo
  6. 6. Vấn đề trong triển khai hệ thống phần mềm
  7. 7. m n
  8. 8. Giải pháp triển khai hệ thống phần mềm
  9. 9. m
  10. 10. Docker xuất hiện mở ra cuộc cách mạng về ảo hoá
  11. 11. So sánh với các HyperVisor
  12. 12. HyperVisor Type 2 Docker Virtualization Type Vitualization Machine Container Weight of the created virtual systems Heavy Very lightweight Startup time for created machine A few minutes A few seconds Isolation level for created vitural systems Full Partial Guaranteed Resources at Hardware Level ? Yes No Can create machines with different OS ? Yes No
  13. 13. Kiến trúc Docker
  14. 14. Nginx Php - fpm Mysql Docker Container Simple web app
  15. 15. Các vấn đề liên quan đến triển khai hệ thống sử dụng docker Health Discovery Scheduling Configuration Scaling Security There are more! Monitoring
  16. 16. Agenda  Bối cảnh  Nhắc lại về Docker  Giới thiệu Kubernetes  Kiến trúc Kubernetes  Các thành phần cơ bản trong Kubernetes  Rancher 2.0  Harbor – Docker registry  Demo
  17. 17. κυβερνήτης
  18. 18. k8s
  19. 19. Kubernetes  Manage application, not machine  Kubernetes là một Platform tự động hoá việc quản lý, scaling container  Kubernetes còn gọi là Container orchestration engine.  Kubernetes by Google dựa trên kinh nghiệm quản lý sử dụng các container
  20. 20. =
  21. 21. Kubernetes vs Docker Swarm https://platform9.com/blog/kubernetes-docker-swarm-compared/
  22. 22. Kubernetes làm được những gì  Việc quản lý hàng loạt docket host  Container Scheduling  Rolling update  Scaling/Auto Scaling  Monitor vòng đời và tình trạng sống chết của container.  Self-healing trong trường hợp có lỗi xãy ra. (Có khả năng phát hiện và tự correct lỗi)  Service discovery  Load balancing  Quản lý data  Quản lý work node  Quản lý log  Infrastructure as Code  Sự liên kết và mở rộng với các hệ thống khác
  23. 23. Kubernetes liên kết với hệ sinh thái  Ansible: Deploy container tới Kubernetes  Apache Ignite: Sử dụng Service Discovery của Kubernetes, tự động tạo và scaling k8s clkuster  Fluentd: gửi log của container trong Kubernetes  Jenkins: Deploy container đến Kubernetes  OpenStack:Cấu trúc k8s liên kết với Cloud  Prometheus: Monitor Kubernetes  Spark: Thực thi native job trên Kubernetes(thay thế cho YARN)  Spinnaker:Deploy container đến Kubernetes  v.v
  24. 24. Các môi trường Kubernetes  Local Kubermetes  Công cụ hỗ trợ thiết lập môi trường Kubernetes  Quản lý Kubernetes trên public cloud
  25. 25. Local Kubermetes Minikube Docker for Mac
  26. 26. Công cụ hỗ trợ thiết lập môi trường Kubernetes  kubeadm  Rancher
  27. 27. Quản lý Kubernetes trên public cloud  Google Kubernetes Engine(GKE)  Azure Container Service(AKS)  Elastic Container Service for Kubernetes(EKS) GKE AKS
  28. 28. GKE(Google Kubernetes Engine)
  29. 29. Agenda  Giới thiệu  Nhắc lại về Docker  Giới thiệu Kubernetes  Kiến trúc Kubernetes  Các thành phần cơ bản trong Kubernetes  Rancher 2.0  Harbor – Docker registry  Demo
  30. 30. Agenda  Giới thiệu  Nhắc lại về Docker  Giới thiệu Kubernetes  Kiến trúc Kubernetes  Các thành phần cơ bản trong Kubernetes  Rancher 2.0  Harbor – Docker registry  Demo
  31. 31. Node
  32. 32. Hosts running k8s daemons
  33. 33. Node Node Node Master API Scheduler etc.. kubelet kubelet kubelet
  34. 34. Kubernetes Resource Phân Loại Resource Mô tả Workloads Resource liên quan đến thực thi container Discovery&Load balancer Resource cung cấp Endpoint - cho phép truy cập Container từ bên ngoài Cluster Config&Storage Resources liên quan đến settings, confidential information, persistent volumes vv Cluster Resources liên quan đến security và quota Metadata Resource cho việc quản lý Resource
  35. 35. Workloads Pod ReplicationController ReplicaSet Deployment DaemonSet StatefulSet Job CronJob Discovery&LB resource Service ClusterIP NodePort LoadBalancer ExternalIP ExternalName Headless Ingress Config&Storage Secret ConfigMap PersistentVolumeClaim Cluster resource Namespace ServiceAccount Role ClusterRole RoleBinding ClusterRoleBinding NetworkPolicy ResourceQuota PersistentVolume Node Metadata resource CustomResourceDefinition LimitRange HorizontalPodAutoscaler
  36. 36. Workloads Pod ReplicationController ReplicaSet Deployment DaemonSet StatefulSet Job CronJob Discovery&LB resource Service ClusterIP NodePort LoadBalancer ExternalIP ExternalName Headless Ingress Config&Storage Secret ConfigMap PersistentVolumeClaim Cluster resource Namespace ServiceAccount Role ClusterRole RoleBinding ClusterRoleBinding NetworkPolicy ResourceQuota PersistentVolume Node Metadata resource CustomResourceDefinition LimitRange HorizontalPodAutoscaler Application Developer normally use 3 types
  37. 37. Workloads Pod ReplicationController ReplicaSet Deployment DaemonSet StatefulSet Job CronJob Discovery&LB resource Service ClusterIP NodePort LoadBalancer ExternalIP ExternalName Headless Ingress Config&Storage Secret ConfigMap PersistentVolumeClaim
  38. 38. Pod
  39. 39. Basic unit of deployment in k8s
  40. 40. Group of container
  41. 41. Container configuration
  42. 42. Shared storage
  43. 43. Pod container container container Volume NIC
  44. 44. Pod container container container nginx frontend app redis/cache e.g.
  45. 45. Scheduled together
  46. 46. Guaranteed to be on the same node
  47. 47. container container container container container container container container container Node Node Node Pod Pod Pod
  48. 48. container container container container container container Node 1 Node 2 Node 3 Pod Pod container container container Pod container container container Pod container container container Pod container container container Pod container container container Pod Depends on each node’s resource availability and each pod’s resource requirement
  49. 49. container container container Node Node
  50. 50. container container container Node Node This will NEVER happen
  51. 51. MasterAPI UI CLI Node 1 Node 2 Node 3 Pod
  52. 52. Pod Node MasterAPI UI CLI Node 1 Node 2 Node 3 Pod =
  53. 53. Demo Pod
  54. 54. ReplicaSet
  55. 55. Keep track of Pod replicas
  56. 56. Replica Set replica: 3 template: container container container Pod A container container container Pod
  57. 57. Replica Set replica: 3 template: container container container Pod B container container container Pod A container container container Pod
  58. 58. Replica Set replica: 3 template: container container container Pod B container container container Pod A container container container Pod C container container container Pod
  59. 59. Replica Set container container container Podreplica: 3 template: container container container Pod B container container container Pod A container container container Pod C
  60. 60. Replica Set replica: 3 template: container container container Pod B container container container Pod A container container container Pod D container container container Pod
  61. 61. Auto healing
  62. 62. Deployment
  63. 63. Manages Replicas Set state transitions
  64. 64. Deployment container container container Podreplica: 3 template:
  65. 65. Deployment ReplicaSet A container container container Pod replica: 3 template: container container container Podreplica: 3 template:
  66. 66. Deployment ReplicaSet A containe r containe r containe r Pod replica: 3 template: Change some setting, please! container container container Podreplica: 3 template:
  67. 67. Deployment ReplicaSet A Change some setting, please! replica: 3 template: container container container Podreplica: 3 template: container container container Pod replica: 3 template:
  68. 68. Deployment ReplicaSet A Change some setting, please! ReplicaSet B replica: 3 template: container container container Podreplica: 3 template: container container container Pod replica: 3 template: container container container Pod replica: 3 template:
  69. 69. Deployment ReplicaSet A Change some setting, please! ReplicaSet B replica: 3 template: container container container Podreplica: 3 template: container container container Pod replica: 3 template:
  70. 70. Deployment ReplicaSet B replica: 3 template: container container container Podreplica: 3 template: container container container Pod replica: 3 template:
  71. 71. Keep track of state change history
  72. 72. Deployme nt ReplicaSet B replica: 3 template: container container container Pod replica: 3 template: container container container Podreplica: 3 template:
  73. 73. Deployment Oh wait, I actually didn’t want to do that ReplicaSet B replica: 3 template: container container container Pod replica: 3 template: container container container Podreplica: 3 template:
  74. 74. Deployment Oh wait, I actually didn’t want to do that ReplicaSet B Rollback container container container Pod replica: 3 template: container container container Podreplica: 3 template:
  75. 75. Deployment ReplicaSet A ReplicaSet B Oh wait, I actually didn’t want to do that Rollback container container container Pod replica: 3 template: container container container Podreplica: 3 template: container container container Pod replica: 3 template:
  76. 76. Deployment ReplicaSet A ReplicaSet B Oh wait, I actually didn’t want to do that Rollback container container container Podreplica: 3 template: container container container Pod replica: 3 template:
  77. 77. Deployment ReplicaSet A container container container Podreplica: 3 template: container container container Pod replica: 3 template:
  78. 78. Rolling update Pod
  79. 79. DaemonSet
  80. 80. DaemonSet: Schedule Pod một cách tuần tự từng Pod một trên tất cả các Node.  Use case  Fluentd: Collect logs tool  Datadog: Monitoring tool
  81. 81. Job
  82. 82. Job = Pod + batch = env + batch  Job  Start Pod (container centos)  Run command: sleep 60;  Finish
  83. 83.  restartPolicy  OnFailure: Use this Pod to run job again  Never: Create new Pod if Pod had problem and run job
  84. 84.  completions: 1  Job success one time and finish  parallelism: 1  run parallelism 1 pod  backoffLimit: 10  Allows failing 10 times
  85. 85. Run job one time
  86. 86. CronJob
  87. 87. Cronjob = Job + schedule Crontab = batch + schedule
  88. 88. Cronjob = Job + schedule 1 2 3
  89. 89. Cronjob = Job + schedule  schedule  same cron format  http://www.nncron.ru/help/EN/working/cron -format.htm  Setting  concurrencyPolicy  Allow(default): Không hạn chế đối với việc thực thi đồng thời  Forbid: Job trước đó thực hiện chưa xong thì không tạo Job mới.(không thực hiện đồng thời)  Replace: Trong trường hợp Job cũ đang chạy, huỷ Job cũ và tạo Job mới 1 2 3
  90. 90. Cronjob = Job + schedule  schedule  Setting  startingDeadlineSeconds  Thời gian trễ cho phép để run job  successfulJobsHistoryLimit  Số lượng Job thành công được duy trì  failedJobsHistoryLimit  Số lượng Job thất bại duy trì.  Job 1 2 3
  91. 91. K8s Cronjob vs cron job in linux
  92. 92. Problem in cron job in linux Job
  93. 93. Problem in cron job in linux Job That’s OK ??? Job
  94. 94. Solution with K8s Cronjob Job Node 1 Node 2
  95. 95. Solution with K8s Cronjob Job Node 1 Node 2
  96. 96. Solusion with K8s Cronjob Node 1 Node 2 Job
  97. 97. Workloads Pod ReplicationController ReplicaSet Deployment DaemonSet StatefulSet Job CronJob Discovery&LB resource Service ClusterIP NodePort LoadBalancer ExternalIP ExternalName Headless Ingress Config&Storage Secret ConfigMap PersistentVolumeClaim
  98. 98. Workloads Pod ReplicationController ReplicaSet Deployment DaemonSet StatefulSet Job CronJob Discovery&LB resource Service ClusterIP NodePort LoadBalancer ExternalIP ExternalName Headless Ingress Config&Storage Secret ConfigMap PersistentVolumeClaim
  99. 99. Kubernetes network
  100. 100. ClusterIP
  101. 101. ClusterIP Service :80 :80 :80
  102. 102. ExternalIP
  103. 103. :80 :80 :80 ExtenalIP Service
  104. 104. NodePort
  105. 105. :80 :80 :80 NodePort Service
  106. 106. :80 :80 :80 NodePort Service
  107. 107. NodePort Service
  108. 108. NodePort Service
  109. 109. LoadBalancer
  110. 110. Load Balancer Service
  111. 111. LoadBalancer support for GKE AKS
  112. 112. Loadbalancer for my K8s ??? https://www.weave.works/blog/kubernetes-faq-how- can-i-route-traffic-for-kubernetes-on-bare-metal
  113. 113. MetalLB https://metallb.universe.tf/
  114. 114. Workloads Pod ReplicationController ReplicaSet Deployment DaemonSet StatefulSet Job CronJob Discovery&LB resource Service ClusterIP NodePort LoadBalancer ExternalIP ExternalName Headless Ingress Config&Storage Secret ConfigMap PersistentVolumeClaim
  115. 115. Agenda  Bối cảnh  Nhắc lại về Docker  Giới thiệu Kubernetes  Kiến trúc Kubernetes  Các thành phần cơ bản trong Kubernetes  Rancher 2.0  Harbor – Docker registry  Demo
  116. 116. Rancher is redesigned to work on Kubernetes.
  117. 117. Rancher 2.0
  118. 118. Agenda  Bối cảnh  Nhắc lại về Docker  Giới thiệu Kubernetes  Kiến trúc Kubernetes  Các thành phần cơ bản trong Kubernetes  Rancher 2.0  Harbor – Docker registry  Demo
  119. 119. Docker registry
  120. 120. Docker registry
  121. 121. Docker registry
  122. 122. Kiến trúc Harbor
  123. 123. Kiến trúc Harbor
  124. 124. MasterAPICLI
  125. 125. MasterAPICLI Kube-demo CLI Push images
  126. 126. MasterAPICLI Kube-demo code-pvc 2G nginx-config- pvc 1G CLI
  127. 127. MasterAPICLI Kube-demo code-pvc 2G CLInginx-config- pvc 1G
  128. 128. MasterAPICLI Kube-demo code-pvc 2G CLI Pull images nginx-config- pvc 1G
  129. 129. MasterAPICLI Pull images NIC NIC code-pvc 2G NodePort *:32253 Pod (nginx, php-fpm) Volume Kube-demo nginx-config- pvc 1G DB
  130. 130. MasterAPICLI Pull images NIC NIC code-pvc 2G NodePort *:32253 Pod (nginx, php-fpm) Volume Kube-demo nginx-config- pvc 1G DB Frontend
  131. 131. MasterAPICLI Pull images NIC NIC code-pvc 2G NodePort *:32253 Pod Volume Kube-demo nginx-config- pvc 1G DB Frontend Backend
  132. 132. MasterAPICLI Pull images NIC NIC NodePort *:32253 Images code-pvc 2G nginx-config- pvc 1G DB Frontend Backend Pod Volume NIC NIC Elasticsearch Kibana Design Security
  133. 133. MasterAPICLI Pull images NIC NIC NodePort *:32253 Images code-pvc 2G nginx-config- pvc 1G DB Frontend Backend Pod Volume NIC NIC Elasticsearch Kibana Design Security
  134. 134. Workloads Pod ReplicationController ReplicaSet Deployment DaemonSet StatefulSet Job CronJob Discovery&LB resource Service ClusterIP NodePort LoadBalancer ExternalIP ExternalName Headless Ingress Config&Storage Secret ConfigMap PersistentVolumeClaim Cluster resource Namespace ServiceAccount Role ClusterRole RoleBinding ClusterRoleBinding NetworkPolicy ResourceQuota PersistentVolume Node Metadata resource CustomResourceDefinition LimitRange HorizontalPodAutoscaler Application Developer normally use 3 types
  135. 135. Kubernetes For Beginner Docker Docker-compose K8s
  136. 136. Tài Liệu Tham Khảo  https://kubernetes.io/docs/tutorials/  Serial blog kubernetes  https://blog.vietnamlab.vn/2018/09/25/nhap-mon- kubernetes-gioi-thieu-rerial-kubernetes/  https://github.com/gmo-vietnamlab/kubernetes- research-demo
  • HngLu18

    May. 16, 2019

Kubernetes is a platform used to automate the management, to scale and to deploy applications in the form of containers. Kubernetes is also called Container orchestration engine.

Views

Total views

256

On Slideshare

0

From embeds

0

Number of embeds

1

Actions

Downloads

0

Shares

0

Comments

0

Likes

1

×