An Introduction to Kubernetes and CNI
About Me
• 鄭偉聖, SAM
• CS student in NCTU
• Intern in National Center for High-performance Computing(NCHC)
• Intern in Industrial Technology Research Institute (ITRI)
• Familiar with OpenStack, Docker, Kubernetes
• Golang and Python
• Email: kweisamx.cs05g@g2.nctu.edu.tw
• GitHub: github.com/kweisamx
VM v.s Container
4
Why we need Kubernetes ?
Why we need Kubernetes ?
Agenda
Introduction Kubernetes
Architecture
How to build Kubernetes cluster
Application
Conclusion & QA
Introduction to Kubernetes
 100% opensource, written by Golang
 Platform for automating, deployment, and operation
 Inspired and informed by Google’s experiences and “Borg”
 The name is mean ”helmsman” and “pliot”
 Aka k8s , replace “ubernete” with 8
Architecture
 Master-Slave
 Master used to controller the cluster and offer API
 Node mostly run the container to offer service
Architecture
Kubernetes Master
 Etcd: Use to store the cluster status
 ApiServer: Use Restful Api to get informati
on or post request with json
 Controller Manager Server: Controller the
cluster
 Schedular: schedule resource for container
Kubernetes Node
 Kubelet: connect with apiserver, handle d
ata, volumn, image, status for container
 Kube-proxy: handle the service routing, an
d support Load Balance
 A Group of co-located containers(one or more)
 Shared the same value and network namespace/ip port
 Restart pofile
 Healthy
 Templates(yaml)
12
Pod
Pod
Pod
 Arbitrary metadata
 The connect with Replication controller and pods
 key/value pairs
 identify a set of objects via a label selector
15
Label
Label
• Ensures that a specified number of pod “replicas” running at any time
• Flexible scale
• Auto change the replica
• Rolling Update
Replica Set
Replica Set
Replica Set
Replica Set
21
Replica Set
22
Replica Set
• We create the pod , which pod of label is test:rc
• And then we change the pod’s labels from rc to rc2
• Because kubernetes get the information that no pod label is “rc”, so it
create the new one
23
Replica Set
• And we delete the pod
• Yes, the pod is different, that because the
ReplicationController keep number is 1 of the pod
which label is “rc” 24
Replica Set
• And we can also change the number of replica
• Ofcourse, you can shrink the number of replica
25
Replica Set
• Use by deployment and ReplicationController
• Update period
• Reverse the version(if you need)
Rolling Update
ServiceService
• Kubernetes recommand us use deployment to build our
container cluster
• All feature of replica set
• Provides declarative updates for Pods and Replica Sets
• More Powerful
Deployment
• Test: rolling update
– Set Image
– Replace
• Change the yaml to update by use <kubectl replace –f >
– Edit
• Kubectl edit deploment <your deploment>
Deploment
Deploment
• Edit
Deploment
• Defines a logical set of Pods and a policy by which to access them.
• A service rule defines a TCP or UDP port reservation
• Provides a way for applications running in containers to connect
• Use labels
• Clutser IP
31
Service
Service
Service
How to Build Kubernetes?
 Kubeadm : quickly, easy , but not recommended to build production
cluster, master don’t have high availability
 Kubespray: Use with Ansible, and support many add-on, can build for
production, but recommend to familiar with Ansible
 Kops: Use in Cloud like AWS , GCP, easy to build your cluster
 Bootkube: Now in kubernetes-incubator, can be used to generate all of
the necessary assets for use in bootstrapping a new cluster
 Kubernetes the Hard Way: The most hard way to bulid, but you can
learn much of kubernets
• The simple interface between container runtime and network implement
• Originated at CoreOS as part Rkt
• CNCF project
Container Network Interface
Container Network Interface
Thank You!
Q&A

Introduction kubernetes 2017_12_24

  • 1.
    An Introduction toKubernetes and CNI
  • 2.
    About Me • 鄭偉聖,SAM • CS student in NCTU • Intern in National Center for High-performance Computing(NCHC) • Intern in Industrial Technology Research Institute (ITRI) • Familiar with OpenStack, Docker, Kubernetes • Golang and Python • Email: kweisamx.cs05g@g2.nctu.edu.tw • GitHub: github.com/kweisamx
  • 3.
  • 4.
    4 Why we needKubernetes ?
  • 5.
    Why we needKubernetes ?
  • 6.
    Agenda Introduction Kubernetes Architecture How tobuild Kubernetes cluster Application Conclusion & QA
  • 7.
    Introduction to Kubernetes 100% opensource, written by Golang  Platform for automating, deployment, and operation  Inspired and informed by Google’s experiences and “Borg”  The name is mean ”helmsman” and “pliot”  Aka k8s , replace “ubernete” with 8
  • 8.
    Architecture  Master-Slave  Masterused to controller the cluster and offer API  Node mostly run the container to offer service
  • 9.
  • 10.
    Kubernetes Master  Etcd:Use to store the cluster status  ApiServer: Use Restful Api to get informati on or post request with json  Controller Manager Server: Controller the cluster  Schedular: schedule resource for container
  • 11.
    Kubernetes Node  Kubelet:connect with apiserver, handle d ata, volumn, image, status for container  Kube-proxy: handle the service routing, an d support Load Balance
  • 12.
     A Groupof co-located containers(one or more)  Shared the same value and network namespace/ip port  Restart pofile  Healthy  Templates(yaml) 12 Pod
  • 13.
  • 14.
  • 15.
     Arbitrary metadata The connect with Replication controller and pods  key/value pairs  identify a set of objects via a label selector 15 Label
  • 16.
  • 17.
    • Ensures thata specified number of pod “replicas” running at any time • Flexible scale • Auto change the replica • Rolling Update Replica Set
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
    • We createthe pod , which pod of label is test:rc • And then we change the pod’s labels from rc to rc2 • Because kubernetes get the information that no pod label is “rc”, so it create the new one 23 Replica Set
  • 24.
    • And wedelete the pod • Yes, the pod is different, that because the ReplicationController keep number is 1 of the pod which label is “rc” 24 Replica Set
  • 25.
    • And wecan also change the number of replica • Ofcourse, you can shrink the number of replica 25 Replica Set
  • 26.
    • Use bydeployment and ReplicationController • Update period • Reverse the version(if you need) Rolling Update ServiceService
  • 27.
    • Kubernetes recommandus use deployment to build our container cluster • All feature of replica set • Provides declarative updates for Pods and Replica Sets • More Powerful Deployment
  • 28.
    • Test: rollingupdate – Set Image – Replace • Change the yaml to update by use <kubectl replace –f > – Edit • Kubectl edit deploment <your deploment> Deploment
  • 29.
  • 30.
  • 31.
    • Defines alogical set of Pods and a policy by which to access them. • A service rule defines a TCP or UDP port reservation • Provides a way for applications running in containers to connect • Use labels • Clutser IP 31 Service
  • 32.
  • 33.
  • 34.
    How to BuildKubernetes?  Kubeadm : quickly, easy , but not recommended to build production cluster, master don’t have high availability  Kubespray: Use with Ansible, and support many add-on, can build for production, but recommend to familiar with Ansible  Kops: Use in Cloud like AWS , GCP, easy to build your cluster  Bootkube: Now in kubernetes-incubator, can be used to generate all of the necessary assets for use in bootstrapping a new cluster  Kubernetes the Hard Way: The most hard way to bulid, but you can learn much of kubernets
  • 35.
    • The simpleinterface between container runtime and network implement • Originated at CoreOS as part Rkt • CNCF project Container Network Interface
  • 36.
  • 37.

Editor's Notes

  • #32 什麼是存取規則 就是如何存取該服務的規則,比方說 TCP/UDP、Port 等等相關規則。