SlideShare a Scribd company logo
利用 Kubernetes 實現
高可靠應用
alfieYFC inwinSTACK
alfie.yfc inwinSTACK
Alfie Chen
2017/11/21
alfie.c@inwinstack.com
Agenda
World of Microservices
Kubernetes for Beginners
NodeRed Chatbot w/ K8S
World of Microservices
Virtual Machines, Containers, etc.
App Development Changes
• Huge Applications
• Hours to Build
• Huge Downtime
• Microservices
• Container Deployment
• Independent Deployments
• Fast Version Releases
What is Microservices?
Kitchen
Office
Men’s Room Women’s Room
Frontdesk
Dining Area
entrance
What is Microservices?
Kitchen
Office
Men’s Room Women’s Room
Frontdesk
Dining Area
entrance
Nginx
(Reverse Proxy Service)
Bootstrap
(Front-end Framework)
Rails
(Web Framework)
Sidekiq
(Background Processing Framework)
Redis
(Storage)
Postgresql
(Database)
Elastic
(DB Search Engine)
What is Microservices?
What is Microservices?
Physical Server
VM VM VM VM
Hypervisor
Physical Server
Software Program
010101010101010
101010101010101
010101010101010
101010101010101
010101010101010
010101010101010
101010101010101
010101010101010
101010101010101
010101010101010
010101010101010
101010101010101
010101010101010
101010101010101
010101010101010
010101010101010
101010101010101
010101010101010
101010101010101
010101010101010
What is Microservices?
What is Microservices?
Kitchen
Office
Men’s Room Women’s Room
Frontdesk
Dining Area
entrance
What is Microservices?
Physical Server
Software Program
Physical Server
VM VM VM VM
Hypervisor
Physical Server
Container Container Container Container
Container Engine
(Docker)
Kitchen
Office
Men’s Room Women’s Room
Frontdesk
Dining Area
entrance
What is Microservices?
Kitchen
Office
Men’s Room Women’s Room
Frontdesk
Dining Area
entrance
Physical Server
Container Container Container Container
Container Engine
(Docker)
Kubernetes for Beginners (kinda..)
Kubernetes Cluster
Physical Server
Minion
kube-proxykubelet
Pod
Container
Container
Pod
Container
Pod
Container
Pod
Container
Container
Physical Server
Minion
kube-proxykubelet
Pod
Container
Container
Pod
Container
Pod
Container
Container
10G
Switch
Network:172.24.0.0/24
Gateway:172.24.0.254
Physical Server
Master
Controller
Manager
etcdSchedulerAPI Server
Kubernetes Cluster
Physical Server
Minion
kube-proxykubelet
Pod
Container
Container
Pod
Container
Pod
Container
Pod
Container
Container
Physical Server
Minion
kube-proxykubelet
Pod
Container
Container
Pod
Container
Pod
Container
Container
Physical Server
Master
Controller
Manager
etcdSchedulerAPI Server
Concepts & Terms
• Controllers
o Deployment (deploy)
o Stateful Set
o Daemon Set (ds)
o Jobs
https://kubernetes.io/docs/concepts/
Concepts & Terms
• Deployment (deploy)
o Stateless
o Availability > Consistency
o Web Frontends
o Rolling Update
Concepts & Terms
• Deployment (deploy)
o Stateless
o Availability > Consistency
o Web Frontends
Concepts & Terms
• Stateful Set
o Persistent data
o Availability < Consistency
o Each has its own identity
o Databases, Message queues
Concepts & Terms
• Daemon Set
o Background process
o One pod per node
o Node labels
o Cluster storage, logs, node monitoring
Concepts & Terms
• Jobs
o Batch Pattern
o Run in parallel
o Run to completion (then exit)
o Independent but related processes
NodeRed Chatbot w/ K8S
Running FB RedBot containers as a Deployment
Why Chatbots?
• Make the Most of Emerging Trends
• Access Information Faster
• Consistent & Controllable Conversation
• Integrate Social Media and Sales
• Informal Brand Chats
VM Architecture 1
LoadBalancer
VMVM VMVM VMVM
Response
VM Architecture 2
<func>
Pass Master
Response Only
VM
VM
MQ
Master
Slave
Response
K8S Architecture
Minion
Pod Pod
Webhook
Load-Balance
/
Node-Port
Service
K8S Architecture
Benefits:
• Resource Utilization
• Scalability
• Auto Load-balance
• Self-healing
Challenges:
• Logging
• Chat Conversation
Who am I talking to?!!!
Hi!
My name is
Kamekube!
Hi! What’s
your name?
Possible Solution?
• Load-balance?
• Cache?
Minion
Pod1 Pod2 Pod3 Pod4
DB
[Username:Conv0001:Bot3]
Pod
MB
Pod
MB
Pod
MB
Pod
MB
Pod
MB
Webhook
Load-Balance
/
Node-Port
Service
What else?
I’m
Leaving it
to the
Smarter People
(YOU!)
www.inwinstack.com
Thank You!
迎 棧 科 技 股 份 有 限 公 司

More Related Content

利用K8S實現高可靠應用