SlideShare a Scribd company logo
Kubernetes in Kubernetes:
搭建高可用環境
資訊與通訊研究所 蔣是文 Mac Chiang
交通大學資工所 鄭偉聖 Sam Zheng
Copyright 2017 ITRI 工業技術研究院
Agenda
• Cluster Management Issues
• Self-hosted Kubernetes
• Service with High Availability
• Summary
2
Copyright 2017 ITRI 工業技術研究院
Microservices Challenges
3
• A lots of microservices/components
• Zero downtime deployment
• Incremental roll out of features faster
• Improves the ability scale efficiently
Copyright 2017 ITRI 工業技術研究院
Kubernetes Cluster
4
• Scheduling
• Deployment
• Healing
• Discovery/Load balancing
• Scaling
But how about operating Kubernetes?
Copyright 2017 ITRI 工業技術研究院
Kubernetes Operation Tasks
5
• Deployment
• Upgrade / rollback
• Scaling
• Monitoring
• Healing
• Security
• …
• A lot of manual/semi-manual work
• No standard way to approach all the problems
Problems!
http://www.infoq.com/cn/presentations/self-hosted-infrastructure-take-kubernetes-as-an-example
Copyright 2017 ITRI 工業技術研究院
What’s Self-hosted Kubernetes?
6
• Running all required and optional components of a
Kubernetes cluster on top of Kubernetes itself
• Kubernetes manages own core components
• Core component deployed as native API objects
https://www.youtube.com/watch?v=EbNxGK9MwN4
Copyright 2017 ITRI 工業技術研究院
Why Self-hosted Kubernetes?
7
• Small Dependencies
▪ Reduce the number of components required (Kubelet and Docker)
• Deployment consistency
▪ Reduce the number of moving parts relying on the host OS
• Introspection
▪ Can be debugged and inspected by users using existing Kubernetes APIs
• Cluster Upgrades
▪ Upgrade the components via Kubernetes APIs
• Easier Highly-Available Configurations
▪ Easier to scale up and monitor an HA environment without complex external tooling
https://github.com/kubernetes/community/blob/master/contributors/design-proposals/self-hosted-kubernetes.md
Copyright 2017 ITRI 工業技術研究院
Launching a Self-hosted Cluster
8
• Need an initial control plane to bootstrap a self-hosted
cluster
• Bootkube
▪ Provides a temporary control plane to run a full blown self-hosted control
plane
▪ Run only on very first node, then not needed again
https://www.youtube.com/watch?v=EbNxGK9MwN4
Copyright 2017 ITRI 工業技術研究院
Kubernetes Architecture
9
Master node
etcd
Scheduler
Controller
Manager
API Server
Worker node
Kubelet Kube-proxy
dockerPod Pod
Worker node
Kubelet Kube-proxy
dockerPod Pod
Copyright 2017 ITRI 工業技術研究院
Spectrum of Self-hosted Ways
10
https://github.com/kubernetes/community/blob/master/contributors/design-proposals/self-hosted-kubernetes.md
• 0-4 self-hosted cluster
• kubelet: daemon set
• API server: pod / service
• 1-4 self-hosted cluster
• system installed Kubelet
• 2-4 self-hosted cluster
• everything except etcd self-hosted
Copyright 2017 ITRI 工業技術研究院
How bootkube works?
11
etcd
Bootkube
API Server
Scheduler
Controller
Manager
Kubelet
Copyright 2017 ITRI 工業技術研究院
How bootkube works? (cont.)
12
etcd
Bootkube
API Server
Scheduler
Controller
Manager
Kubelet
Create
• Deployment
• Daemonset
• Service
• Secret
kubectl
Copyright 2017 ITRI 工業技術研究院
How bootkube works? (cont.)
13
etcd
Bootkube
API Server
Scheduler
Controller
Manager
Kubelet
Pods
API Server
Scheduler
Controller
Manager
create
Copyright 2017 ITRI 工業技術研究院
How bootkube works? (cont.)
14
etcd
Bootkube
API Server
Scheduler
Controller
Manager
Kubelet
Pods
API Server
Scheduler
Controller
Manager
create
Copyright 2017 ITRI 工業技術研究院
Pods
How bootkube works? (cont.)
15
etcd
Kubelet
API Server
Scheduler
Controller
Manager
Copyright 2017 ITRI 工業技術研究院
Self-hosted Control Plane
16
[root@centos7 ~]# kubectl get pod -n kube-system
NAME READY STATUS RESTARTS AGE
kube-apiserver-kkxq9 1/1 Running 0 1d
kube-controller-manager-2953862963-t7m1q 1/1 Running 0 1d
kube-controller-manager-2953862963-wlsjp 1/1 Running 0 1d
kube-dns-2431531914-gqnnd 3/3 Running 0 1d
kube-flannel-wnk1j 2/2 Running 0 1d
kube-flannel-xcsx2 2/2 Running 0 1d
kube-flannel-xrksj 2/2 Running 1 1d
kube-proxy-04x11 1/1 Running 0 1d
kube-proxy-11n6t 1/1 Running 0 1d
kube-proxy-1zlgz 1/1 Running 0 1d
kube-scheduler-1873817829-4c7mm 1/1 Running 1 1d
kube-scheduler-1873817829-pmp0n 1/1 Running 0 1d
pod-checkpointer-11q7g 1/1 Running 0 1d
pod-checkpointer-11q7g-10.201.3.6 1/1 Running 0 1d
Copyright 2017 ITRI 工業技術研究院
Self-hosted Control Plane (cont.)
17
[root@centos7 ~]# kubectl get deployment -n kube-system
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
kube-controller-manager 2 2 2 2 2d
kube-dns 1 1 1 1 2d
kube-scheduler 2 2 2 2 2d
[root@centos7 ~]# kubectl get svc -n kube-system
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kube-dns 10.3.0.10 <none> 53/UDP,53/TCP 2d
[root@centos7 ~]# kubectl get ds -n kube-system
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE-SELECTOR AGE
kube-apiserver 1 1 1 1 1 node-role.kubernetes.io/master= 2d
kube-flannel 3 3 3 3 3 <none> 2d
kube-proxy 3 3 3 3 3 <none> 2d
pod-checkpointer 1 1 1 1 1 node-role.kubernetes.io/master= 2d
[root@centos7 ~]# kubectl get secret -n kube-system
NAME TYPE DATA AGE
kube-apiserver Opaque 7 2d
kube-controller-manager Opaque 2 2d
Copyright 2017 ITRI 工業技術研究院
Disaster Recovery
18
• Node failure in HA deployments (Kubernetes)
• Partial loss of control plane components (Kubernetes)
• Power cycling the entire control plane (Kubernetes)
• Permanent loss of control plane (External tool)
http://www.infoq.com/cn/presentations/self-hosted-infrastructure-take-kubernetes-as-an-example
Copyright 2015 ITRI 工業技術研究院
Service with High Availability
19
Copyright 2017 ITRI 工業技術研究院
Kubernetes Networking
20
Copyright 2017 ITRI 工業技術研究院 21
Copyright 2017 ITRI 工業技術研究院 22
Copyright 2017 ITRI 工業技術研究院
How do we to export the service IP to
public network on bare metal?
• In kubernetes we have some existed solution
 NodePort
 CloudProvider Load Balancer
 Ingress
• But it is enough?
23
Copyright 2017 ITRI 工業技術研究院
NodePort
24
kubeProxy kubeProxy kubeProxy
NodePort NodePort NodePort
Pod Pod Pod
Copyright 2017 ITRI 工業技術研究院
NodePort
25
kubeProxy kubeProxy kubeProxy
NodePort NodePort NodePort
Pod Pod Pod
Copyright 2017 ITRI 工業技術研究院
Load Balancer
• Cloud Provider e.g. AWS , GCP, OpenStack
• Load Balancer is created by Cloud Provider, and provide
the external IP to for service
• But it is only for Cloud Provider, the bare metal cannot
do this
26
Copyright 2017 ITRI 工業技術研究院
Load Balancer
27
kubeProxy kubeProxy kubeProxy
NodePort NodePort NodePort
Cloud
LoadBalancer
Pod Pod Pod
Copyright 2017 ITRI 工業技術研究院 28
Copyright 2017 ITRI 工業技術研究院
Ingress
29
• HTTP Load Balancing
• SSL Termination
• Content-base Routing
• Not fully for external network
Copyright 2017 ITRI 工業技術研究院
Ingress
30
Ingress
nginx.com echoheaders.com
ServiceA ServiceB
10.0.0.1:80
Copyright 2017 ITRI 工業技術研究院
Ingress
31
Ingress
Controller
Ingress
Resource
Load Balancer
watches configure
Copyright 2017 ITRI 工業技術研究院
Ingress
32
kubeProxy
kubeProxy kubeProxy
Pod PodPodPod PodPod
Momo.foo.com
Jojo.foo.com
yoyo.foo.com
hostnetwork
Copyright 2017 ITRI 工業技術研究院
Ingress
33
kubeProxy
kubeProxy kubeProxy
Pod PodPodPod PodPod
DNS
Copyright 2017 ITRI 工業技術研究院 34
Copyright 2017 ITRI 工業技術研究院
Keep-Alived VIP
• Real High-Availability
• Virtual IP Address
• IP to Service
• Configmap
• DaemonSet
35
Ref :
- https://github.com/kubernetes/contrib/tree/master/keepalived-vip
Copyright 2017 ITRI 工業技術研究院
Keep-Alived VIP
36
kubeProxy kubeProxy kubeProxy
Pod PodPod
Keepalived Keepalived Keepalived
140.113.1.1 140.113.1.2 140.113.1.3
Vip: 140.113.1.50
Copyright 2017 ITRI 工業技術研究院
Keep-Alived VIP
37
kubeProxy kubeProxy kubeProxy
PodPodPod
Keepalived Keepalived Keepalived
140.113.1.1 140.113.1.2 140.113.1.3
Vip: 140.113.1.50
Pod
Copyright 2017 ITRI 工業技術研究院
Keep-Alived VIP
38
kubeProxy kubeProxy kubeProxy
PodPodPod
Keepalived Keepalived Keepalived
140.113.1.1 140.113.1.2 140.113.1.3
Vip: 140.113.1.50
Copyright 2017 ITRI 工業技術研究院 39
Copyright 2017 ITRI 工業技術研究院
Keep-Alived VIP + Ingress
40
kubeProxy kubeProxy kubeProxy
PodPod Pod
Keepalived Keepalived Keepalived
140.113.1.1 140.113.1.2 140.113.1.3
Vip: 140.113.1.50
Momo.foo.com
Jojo.foo.com
Copyright 2017 ITRI 工業技術研究院
Summary
• Self-hosted K8S
▪ Make K8S operations more easier
▪ Bootkube is still a incubator project
▪ Support disaster recovery
• Service with High Availability
▪ Using DNS to provide your service – Ingress
▪ More vip – keepalived-VIP
▪ Using cloud to build your kubernetes – cloud Load Balancer
▪ Test – NodePort
41
Thank you!
macchiang@itri.org.tw
kweisamx.cs05g@g2.nctu.edu.tw
Kubernetes Taiwan User Group

More Related Content

PPTX
Distributed tensorflow on kubernetes
PDF
從Google cloud看kubernetes服務
PDF
利用K8S實現高可靠應用
PDF
Kubernetes and devops
PDF
GitOps - Operation By Pull Request
PDF
How to Run Kubernetes in Restrictive Environments
PPTX
Canary Releases on Kubernetes with Spinnaker, Istio, & Prometheus (2020)
PPTX
Integrate Kubernetes into CORD(Central Office Re-architected as a Datacenter)
Distributed tensorflow on kubernetes
從Google cloud看kubernetes服務
利用K8S實現高可靠應用
Kubernetes and devops
GitOps - Operation By Pull Request
How to Run Kubernetes in Restrictive Environments
Canary Releases on Kubernetes with Spinnaker, Istio, & Prometheus (2020)
Integrate Kubernetes into CORD(Central Office Re-architected as a Datacenter)

What's hot (20)

PDF
Using source code management patterns to configure and secure your Kubernetes...
PDF
Kubernetes scheduling and QoS
PDF
Zero-downtime deployment of Micro-services with Kubernetes
PDF
Open Source at Zalando - OSB Open Source Day 2019
PDF
利用K8S實現高可靠應用
PDF
23 meetup rancher
PDF
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
PDF
Openshift argo cd_v1_2
PDF
Mirantis Contributions to Kubernetes Ecosystem
PPTX
Kubernetes in Highly Restrictive Environments
PDF
Kubernetes on the Edge / 在邊緣的K8S
PDF
DevOps Fest 2020. Дмитрий Кудрявцев. Реализация GitOps на Kubernetes. ArgoCD
PDF
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
PDF
KubeCon EU 2021 Recap - Running Cache-Efficient Builds at Scale on Kubernetes...
PPTX
OpenShift 5 Drop5 demo
PDF
GitOps A/B testing with Istio and Helm
PDF
Cloud Native CI/CD with GitOps
PDF
Kubernetes Monitoring & Best Practices
PDF
Kubernetes Day 2017 - Build, Ship and Run Your APP, Production !!
PDF
Kubecon seattle 2018 workshop slides
Using source code management patterns to configure and secure your Kubernetes...
Kubernetes scheduling and QoS
Zero-downtime deployment of Micro-services with Kubernetes
Open Source at Zalando - OSB Open Source Day 2019
利用K8S實現高可靠應用
23 meetup rancher
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
Openshift argo cd_v1_2
Mirantis Contributions to Kubernetes Ecosystem
Kubernetes in Highly Restrictive Environments
Kubernetes on the Edge / 在邊緣的K8S
DevOps Fest 2020. Дмитрий Кудрявцев. Реализация GitOps на Kubernetes. ArgoCD
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
KubeCon EU 2021 Recap - Running Cache-Efficient Builds at Scale on Kubernetes...
OpenShift 5 Drop5 demo
GitOps A/B testing with Istio and Helm
Cloud Native CI/CD with GitOps
Kubernetes Monitoring & Best Practices
Kubernetes Day 2017 - Build, Ship and Run Your APP, Production !!
Kubecon seattle 2018 workshop slides
Ad

Similar to Kubernetes in kubernetes 搭建高可用環境 (20)

PDF
Kubernetes deployment on bare metal with container linux
PPTX
Kubernetes day 2 Operations
PDF
Cloud-Native Operations with Kubernetes and CI/CD
PPTX
Fabio rapposelli pks-vmug
PDF
Kubernetes extensibility
PPTX
What is serveless?
PPTX
OSDN: Serverless technologies with Kubernetes
PDF
Cncf k8s_network_03 (Ingress introduction)
PDF
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes Meetup
PDF
Kubermatic.pdf
PDF
Kubermatic CNCF Webinar - start.kubermatic.pdf
PPTX
20191201 kubernetes managed weblogic revival - part 2
PDF
'DOCKER' & CLOUD: ENABLERS For DEVOPS
PDF
Docker and Cloud - Enables for DevOps - by ACA-IT
PPTX
Building Developer Pipelines with PKS, Harbor, Clair, and Concourse
PDF
The ultimate Kubernetes Deployment Checklist - Infra to Microservices
PDF
Red Hat and kubernetes: awesome stuff coming your way
PDF
Kubernetes - Sailing a Sea of Containers
PDF
The Kubernetes WebLogic revival (part 2)
PDF
Whose Job Is It Anyway? Kubernetes, CRI, & Container Runtimes
Kubernetes deployment on bare metal with container linux
Kubernetes day 2 Operations
Cloud-Native Operations with Kubernetes and CI/CD
Fabio rapposelli pks-vmug
Kubernetes extensibility
What is serveless?
OSDN: Serverless technologies with Kubernetes
Cncf k8s_network_03 (Ingress introduction)
Metal-k8s presentation by Julien Girardin @ Paris Kubernetes Meetup
Kubermatic.pdf
Kubermatic CNCF Webinar - start.kubermatic.pdf
20191201 kubernetes managed weblogic revival - part 2
'DOCKER' & CLOUD: ENABLERS For DEVOPS
Docker and Cloud - Enables for DevOps - by ACA-IT
Building Developer Pipelines with PKS, Harbor, Clair, and Concourse
The ultimate Kubernetes Deployment Checklist - Infra to Microservices
Red Hat and kubernetes: awesome stuff coming your way
Kubernetes - Sailing a Sea of Containers
The Kubernetes WebLogic revival (part 2)
Whose Job Is It Anyway? Kubernetes, CRI, & Container Runtimes
Ad

More from inwin stack (20)

PDF
Migrating to Cloud Native Solutions
PDF
Cloud Native 下的應用網路設計
PDF
當電子發票遇見 Google Cloud Function
PDF
運用高效、敏捷全新平台極速落實雲原生開發
PDF
The last mile of digital transformation AI大眾化:數位轉型的最後一哩
PDF
整合Cloud Foundry 和 Kubernetes 技術打造企業級雲應用平台解決方案
PDF
An Open, Open source way to enable your Cloud Native Journey
PDF
維運Kubernetes的兩三事
PDF
Serverless framework on kubernetes
PDF
Train.IO 【第六期-OpenStack 二三事】
PDF
Web後端技術的演變
PDF
以 Kubernetes 部屬 Spark 大數據計算環境
PDF
Setup Hybrid Clusters Using Kubernetes Federation
PDF
基於 K8S 開發的 FaaS 專案 - riff
PPTX
使用 Prometheus 監控 Kubernetes Cluster
PDF
Extend the Kubernetes API with CRD and Custom API Server
PDF
Build your own kubernetes apiserver and resource type
PDF
Virtualization inside kubernetes
PDF
Build the Blockchain as service (BaaS) Using Ethereum on Kubernetes
PDF
How to integrate Kubernetes in OpenStack: You need to know these project
Migrating to Cloud Native Solutions
Cloud Native 下的應用網路設計
當電子發票遇見 Google Cloud Function
運用高效、敏捷全新平台極速落實雲原生開發
The last mile of digital transformation AI大眾化:數位轉型的最後一哩
整合Cloud Foundry 和 Kubernetes 技術打造企業級雲應用平台解決方案
An Open, Open source way to enable your Cloud Native Journey
維運Kubernetes的兩三事
Serverless framework on kubernetes
Train.IO 【第六期-OpenStack 二三事】
Web後端技術的演變
以 Kubernetes 部屬 Spark 大數據計算環境
Setup Hybrid Clusters Using Kubernetes Federation
基於 K8S 開發的 FaaS 專案 - riff
使用 Prometheus 監控 Kubernetes Cluster
Extend the Kubernetes API with CRD and Custom API Server
Build your own kubernetes apiserver and resource type
Virtualization inside kubernetes
Build the Blockchain as service (BaaS) Using Ethereum on Kubernetes
How to integrate Kubernetes in OpenStack: You need to know these project

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Spectroscopy.pptx food analysis technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Programs and apps: productivity, graphics, security and other tools
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
sap open course for s4hana steps from ECC to s4
Spectral efficient network and resource selection model in 5G networks
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
The AUB Centre for AI in Media Proposal.docx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
MIND Revenue Release Quarter 2 2025 Press Release
Spectroscopy.pptx food analysis technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Per capita expenditure prediction using model stacking based on satellite ima...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Empathic Computing: Creating Shared Understanding
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Programs and apps: productivity, graphics, security and other tools

Kubernetes in kubernetes 搭建高可用環境

  • 1. Kubernetes in Kubernetes: 搭建高可用環境 資訊與通訊研究所 蔣是文 Mac Chiang 交通大學資工所 鄭偉聖 Sam Zheng
  • 2. Copyright 2017 ITRI 工業技術研究院 Agenda • Cluster Management Issues • Self-hosted Kubernetes • Service with High Availability • Summary 2
  • 3. Copyright 2017 ITRI 工業技術研究院 Microservices Challenges 3 • A lots of microservices/components • Zero downtime deployment • Incremental roll out of features faster • Improves the ability scale efficiently
  • 4. Copyright 2017 ITRI 工業技術研究院 Kubernetes Cluster 4 • Scheduling • Deployment • Healing • Discovery/Load balancing • Scaling But how about operating Kubernetes?
  • 5. Copyright 2017 ITRI 工業技術研究院 Kubernetes Operation Tasks 5 • Deployment • Upgrade / rollback • Scaling • Monitoring • Healing • Security • … • A lot of manual/semi-manual work • No standard way to approach all the problems Problems! http://www.infoq.com/cn/presentations/self-hosted-infrastructure-take-kubernetes-as-an-example
  • 6. Copyright 2017 ITRI 工業技術研究院 What’s Self-hosted Kubernetes? 6 • Running all required and optional components of a Kubernetes cluster on top of Kubernetes itself • Kubernetes manages own core components • Core component deployed as native API objects https://www.youtube.com/watch?v=EbNxGK9MwN4
  • 7. Copyright 2017 ITRI 工業技術研究院 Why Self-hosted Kubernetes? 7 • Small Dependencies ▪ Reduce the number of components required (Kubelet and Docker) • Deployment consistency ▪ Reduce the number of moving parts relying on the host OS • Introspection ▪ Can be debugged and inspected by users using existing Kubernetes APIs • Cluster Upgrades ▪ Upgrade the components via Kubernetes APIs • Easier Highly-Available Configurations ▪ Easier to scale up and monitor an HA environment without complex external tooling https://github.com/kubernetes/community/blob/master/contributors/design-proposals/self-hosted-kubernetes.md
  • 8. Copyright 2017 ITRI 工業技術研究院 Launching a Self-hosted Cluster 8 • Need an initial control plane to bootstrap a self-hosted cluster • Bootkube ▪ Provides a temporary control plane to run a full blown self-hosted control plane ▪ Run only on very first node, then not needed again https://www.youtube.com/watch?v=EbNxGK9MwN4
  • 9. Copyright 2017 ITRI 工業技術研究院 Kubernetes Architecture 9 Master node etcd Scheduler Controller Manager API Server Worker node Kubelet Kube-proxy dockerPod Pod Worker node Kubelet Kube-proxy dockerPod Pod
  • 10. Copyright 2017 ITRI 工業技術研究院 Spectrum of Self-hosted Ways 10 https://github.com/kubernetes/community/blob/master/contributors/design-proposals/self-hosted-kubernetes.md • 0-4 self-hosted cluster • kubelet: daemon set • API server: pod / service • 1-4 self-hosted cluster • system installed Kubelet • 2-4 self-hosted cluster • everything except etcd self-hosted
  • 11. Copyright 2017 ITRI 工業技術研究院 How bootkube works? 11 etcd Bootkube API Server Scheduler Controller Manager Kubelet
  • 12. Copyright 2017 ITRI 工業技術研究院 How bootkube works? (cont.) 12 etcd Bootkube API Server Scheduler Controller Manager Kubelet Create • Deployment • Daemonset • Service • Secret kubectl
  • 13. Copyright 2017 ITRI 工業技術研究院 How bootkube works? (cont.) 13 etcd Bootkube API Server Scheduler Controller Manager Kubelet Pods API Server Scheduler Controller Manager create
  • 14. Copyright 2017 ITRI 工業技術研究院 How bootkube works? (cont.) 14 etcd Bootkube API Server Scheduler Controller Manager Kubelet Pods API Server Scheduler Controller Manager create
  • 15. Copyright 2017 ITRI 工業技術研究院 Pods How bootkube works? (cont.) 15 etcd Kubelet API Server Scheduler Controller Manager
  • 16. Copyright 2017 ITRI 工業技術研究院 Self-hosted Control Plane 16 [root@centos7 ~]# kubectl get pod -n kube-system NAME READY STATUS RESTARTS AGE kube-apiserver-kkxq9 1/1 Running 0 1d kube-controller-manager-2953862963-t7m1q 1/1 Running 0 1d kube-controller-manager-2953862963-wlsjp 1/1 Running 0 1d kube-dns-2431531914-gqnnd 3/3 Running 0 1d kube-flannel-wnk1j 2/2 Running 0 1d kube-flannel-xcsx2 2/2 Running 0 1d kube-flannel-xrksj 2/2 Running 1 1d kube-proxy-04x11 1/1 Running 0 1d kube-proxy-11n6t 1/1 Running 0 1d kube-proxy-1zlgz 1/1 Running 0 1d kube-scheduler-1873817829-4c7mm 1/1 Running 1 1d kube-scheduler-1873817829-pmp0n 1/1 Running 0 1d pod-checkpointer-11q7g 1/1 Running 0 1d pod-checkpointer-11q7g-10.201.3.6 1/1 Running 0 1d
  • 17. Copyright 2017 ITRI 工業技術研究院 Self-hosted Control Plane (cont.) 17 [root@centos7 ~]# kubectl get deployment -n kube-system NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE kube-controller-manager 2 2 2 2 2d kube-dns 1 1 1 1 2d kube-scheduler 2 2 2 2 2d [root@centos7 ~]# kubectl get svc -n kube-system NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE kube-dns 10.3.0.10 <none> 53/UDP,53/TCP 2d [root@centos7 ~]# kubectl get ds -n kube-system NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE-SELECTOR AGE kube-apiserver 1 1 1 1 1 node-role.kubernetes.io/master= 2d kube-flannel 3 3 3 3 3 <none> 2d kube-proxy 3 3 3 3 3 <none> 2d pod-checkpointer 1 1 1 1 1 node-role.kubernetes.io/master= 2d [root@centos7 ~]# kubectl get secret -n kube-system NAME TYPE DATA AGE kube-apiserver Opaque 7 2d kube-controller-manager Opaque 2 2d
  • 18. Copyright 2017 ITRI 工業技術研究院 Disaster Recovery 18 • Node failure in HA deployments (Kubernetes) • Partial loss of control plane components (Kubernetes) • Power cycling the entire control plane (Kubernetes) • Permanent loss of control plane (External tool) http://www.infoq.com/cn/presentations/self-hosted-infrastructure-take-kubernetes-as-an-example
  • 19. Copyright 2015 ITRI 工業技術研究院 Service with High Availability 19
  • 20. Copyright 2017 ITRI 工業技術研究院 Kubernetes Networking 20
  • 21. Copyright 2017 ITRI 工業技術研究院 21
  • 22. Copyright 2017 ITRI 工業技術研究院 22
  • 23. Copyright 2017 ITRI 工業技術研究院 How do we to export the service IP to public network on bare metal? • In kubernetes we have some existed solution  NodePort  CloudProvider Load Balancer  Ingress • But it is enough? 23
  • 24. Copyright 2017 ITRI 工業技術研究院 NodePort 24 kubeProxy kubeProxy kubeProxy NodePort NodePort NodePort Pod Pod Pod
  • 25. Copyright 2017 ITRI 工業技術研究院 NodePort 25 kubeProxy kubeProxy kubeProxy NodePort NodePort NodePort Pod Pod Pod
  • 26. Copyright 2017 ITRI 工業技術研究院 Load Balancer • Cloud Provider e.g. AWS , GCP, OpenStack • Load Balancer is created by Cloud Provider, and provide the external IP to for service • But it is only for Cloud Provider, the bare metal cannot do this 26
  • 27. Copyright 2017 ITRI 工業技術研究院 Load Balancer 27 kubeProxy kubeProxy kubeProxy NodePort NodePort NodePort Cloud LoadBalancer Pod Pod Pod
  • 28. Copyright 2017 ITRI 工業技術研究院 28
  • 29. Copyright 2017 ITRI 工業技術研究院 Ingress 29 • HTTP Load Balancing • SSL Termination • Content-base Routing • Not fully for external network
  • 30. Copyright 2017 ITRI 工業技術研究院 Ingress 30 Ingress nginx.com echoheaders.com ServiceA ServiceB 10.0.0.1:80
  • 31. Copyright 2017 ITRI 工業技術研究院 Ingress 31 Ingress Controller Ingress Resource Load Balancer watches configure
  • 32. Copyright 2017 ITRI 工業技術研究院 Ingress 32 kubeProxy kubeProxy kubeProxy Pod PodPodPod PodPod Momo.foo.com Jojo.foo.com yoyo.foo.com hostnetwork
  • 33. Copyright 2017 ITRI 工業技術研究院 Ingress 33 kubeProxy kubeProxy kubeProxy Pod PodPodPod PodPod DNS
  • 34. Copyright 2017 ITRI 工業技術研究院 34
  • 35. Copyright 2017 ITRI 工業技術研究院 Keep-Alived VIP • Real High-Availability • Virtual IP Address • IP to Service • Configmap • DaemonSet 35 Ref : - https://github.com/kubernetes/contrib/tree/master/keepalived-vip
  • 36. Copyright 2017 ITRI 工業技術研究院 Keep-Alived VIP 36 kubeProxy kubeProxy kubeProxy Pod PodPod Keepalived Keepalived Keepalived 140.113.1.1 140.113.1.2 140.113.1.3 Vip: 140.113.1.50
  • 37. Copyright 2017 ITRI 工業技術研究院 Keep-Alived VIP 37 kubeProxy kubeProxy kubeProxy PodPodPod Keepalived Keepalived Keepalived 140.113.1.1 140.113.1.2 140.113.1.3 Vip: 140.113.1.50 Pod
  • 38. Copyright 2017 ITRI 工業技術研究院 Keep-Alived VIP 38 kubeProxy kubeProxy kubeProxy PodPodPod Keepalived Keepalived Keepalived 140.113.1.1 140.113.1.2 140.113.1.3 Vip: 140.113.1.50
  • 39. Copyright 2017 ITRI 工業技術研究院 39
  • 40. Copyright 2017 ITRI 工業技術研究院 Keep-Alived VIP + Ingress 40 kubeProxy kubeProxy kubeProxy PodPod Pod Keepalived Keepalived Keepalived 140.113.1.1 140.113.1.2 140.113.1.3 Vip: 140.113.1.50 Momo.foo.com Jojo.foo.com
  • 41. Copyright 2017 ITRI 工業技術研究院 Summary • Self-hosted K8S ▪ Make K8S operations more easier ▪ Bootkube is still a incubator project ▪ Support disaster recovery • Service with High Availability ▪ Using DNS to provide your service – Ingress ▪ More vip – keepalived-VIP ▪ Using cloud to build your kubernetes – cloud Load Balancer ▪ Test – NodePort 41