SlideShare uma empresa Scribd logo
1 de 17
Kubernetes
#6. Advanced Scheduling
조대협 (http://bcho.tistory.com)
Agenda
● Taint & toleration
● Node affinity
● Pod Affinity
● TopologyKey
Taint and toleration
Taints
● It allows rejecting deployment of pods to certain node by adding taints to
node. (ex : Master node)
● Format : <key>=<value>:<effect>
● Taints effect
○ NoSchedule: Pod won’t be scheduled to the node if they don’t tolerate the taint
○ PreferNoSchedule: It is soft version of Noschedule, meaning the scheduler will try to avoid
scheduling the pod to the node, but will schedule it to the node if it can’t schedule it
somewhere else
○ NoExecute: Pod is evicted from the node if it is already running on the node, and is not
scheduled onto the node if it is not yet running on the node.
■ tolerationSeconds : if this pod is running and a matching taint is added to the node, then the pod will
stay bound to the node for 3600 seconds, and then be evicted. If the taint is removed before that time,
the pod will not be evicted. (Toration의 효과를 적용 받는 기간, 이 기간이 지나면, toration 효과가 없어지
고, 해당 Pod는 evit/제거 된다.)
Taint and toleration
Taints
● Command
○ kubectl taint nodes [NODE_NAME] [KEY]=[VALUE]:[EFFECT]
○ kubectl taint nodes node1 key=value:NoSchedule
○ kubectl taint node -l myLabel=X dedicated=foo:PreferNoSchedule
Taint and toleration
Toleration
● It is applied to Pod and allows the pods to be deployed to node with
matching taints
● Exceptional case
Taint and toleration
Source : https://livebook.manning.com/#!/book/kubernetes-in-action/chapter-16/section-16-3-1
Node affinity
● cf. node selector : it specifies that pod should only be deployed on nodes
that matched label (Hard affinity)
● Affinity
○ Provide scheduling affinity to node based on label
○ Compared to node selector
■ It can provide “soft/preference” based affinity. (cf. node selector is hard affinity =
must)
■ Label selection is more expressive (not just “AND of exact match”)
Node affinity
Node affinity (beta in 1.10)
● Hard affinity :
requiredDuringSchedulingIgnoredDuringExecution
Same as node selector (but more expressive node selection
syntax)
● Soft affinity :
preferredDuringSchedulingIgnoredDuringExecution
Try to deploy pod to node that matches selector but if it is
not possible the deploy it elsewhere
pod-with-node-affinity.yaml docs/concepts/configuration
apiVersion: v1
kind: Pod
metadata:
name: with-node-affinity
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/e2e-az-name
operator: In
values:
- e2e-az1
- e2e-az2
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: another-node-label-key
operator: In
values:
- another-node-label-value
containers:
- name: with-node-affinity
image: k8s.gcr.io/pause:2.0
Label key in node is “kubernetes.io/e2e-az-name” and whose value is either e2e-az1 or e2e-az2
In addition, among nodes that meet that criteria, nodes with a label whose key is
another-node-label-key and whose value is another-node-label-value should be preferred.
From : https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
Node affinity
Node affinity & Selector-SpreadPriority
● If you create 5 pods with affinity in 2 node cluster, all 5 pods should be created in an node
But 1 of 5 pod is created in node 2.
The reason is that besides the node affinity prioritization function, the Scheduler also uses other prioritization
functions that to decide where to schedule Pod. Selector-SpreadPriority function, which makes sure pods
belonging to the same ReplicaSet are spread around different nodes so a node failure won’t bring the wole
service down.
(Reference : Kubernetes in Action/Manning Chapter 16 page 468)
Pod affinity
Inter pod affinity (beta in 1.10)
● Node affinity : affinity between pod and node
● Pod affinity : give affinity between Pods themselves based on label of pod which is already
running (Same node or Different node)
● Like node affinity , it has two affinity (Hard/Soft)
○ (Hard) requiredDuringSchedulingIgnoredDuringExecution
○ (Soft) preferredDuringSchedulingIgnoredDuringExecution
● It needs to specify topologyKey and labelSelector
● Use case
○ Run db pod in same rack of backend server
○ Run front server in same zone of backend server
○ Run clustered instances in different nodes
Pod affinity
Inter pod affinity example
apiVersion: v1
kind: Pod
metadata:
name: with-pod-affinity
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: security
operator: In
values:
- S1
topologyKey: failure-domain.beta.kubernetes.io/zone
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: security
operator: In
values:
- S2
topologyKey: kubernetes.io/hostname
containers:
- name: with-pod-affinity
image: k8s.gcr.io/pause:2.0
Pod (with-pod-affinity)
Label selector Hard : “S1” in “security”
Label selector Soft/(Weight=100) : “S2” in
“security”
topologyKey : kubernetes.io/hostname
Pod-1
Label = S1:”security”
Pod=2
Label =
S1:”security”,S2:”securit
y”
Pod=3
Label =
S1:”non-secure”,
S2:”security”
Node 1
hostname=server1
Node 2
hostname=server2
Node 3
hostname=server2
Top priority
2nd priority
Will not selected
(it doesn’t meet hard requirement)
Pod affinity
Pod Anti-Affinity
Deploy pod with different place. Use podAntiAffinity instead of podAffinity
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 5
template:
…
spec:
Affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: backend
Ref : Kubernetes in action book
475
Pod affinity
Pod Anti-Affinity
As you can see, only two pods were scheduled—one to node1, the other to
node2. The three remaining pods are all Pending, because the Scheduler isn’t
allowed to schedule them to the same nodes.
Ref : Kubernetes in action book
475
Pod affinity & topologyKey
topologyKey
● Key for node label
● Node affinity is just used to select same node. Pod affinity can be used to select same node
with the pod. TopologyKey extends place concept like from same node to same rack, same
zone, same region.
● How it works
When the scheduler is deciding where to deploy a pod based on affinity setting, it find out
node based on affinity and get topologyKey value from the node. And the pod will be deployed
to one of nodes that has the matched “toplogyKey” value
(Pod 배포시 Affinity에 의해서 배포될 노드를 먼저 계산하고, 그 노드의 topologyKey를 얻은 후에, 그
toplogyKey에 해당하는 라벨을 가진 노드에 배포한다.)
Pod affinity & topologyKey
topologyKey example
Node-1
Label = zone:z1
Node-2
Label = zone:z1
Node-3
Label = zone:z1
Node-4
Label = zone:z2
Node-5
Label = zone:z2
Node-6
Label = zone:z2
Pod
Label = app:mongodb
Pod (node.js)
Label selector : app=mongodb
topologyKey : zone
Assume that pod(node.js) has
affinity with label selector
app=mongodb. The matched
pod is running on Node-2.
pod(node.js) has “zone” as a
topologykey. So pod(node.js)
get the zone value “z1” from
Node-2.
Based on the value, pod2 will
select one of node which has
zone=z1 (Node-1,Node-2,Node-
3)
Pod affinity & topologyKey
topologyKey Examples
Reference : https://medium.com/kokster/scheduling-in-kubernetes-part-2-pod-affinity-
c2b217312ae1
End of document

Mais conteúdo relacionado

Mais procurados

DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesRonny Trommer
 
KubeCon EU 2016: Kubernetes Storage 101
KubeCon EU 2016: Kubernetes Storage 101KubeCon EU 2016: Kubernetes Storage 101
KubeCon EU 2016: Kubernetes Storage 101KubeAcademy
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewBob Killen
 
Getting started with kubernetes
Getting started with kubernetesGetting started with kubernetes
Getting started with kubernetesJanakiram MSV
 
Introduction to the Container Network Interface (CNI)
Introduction to the Container Network Interface (CNI)Introduction to the Container Network Interface (CNI)
Introduction to the Container Network Interface (CNI)Weaveworks
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideBytemark
 
Kubernetes Probes (Liveness, Readyness, Startup) Introduction
Kubernetes Probes (Liveness, Readyness, Startup) IntroductionKubernetes Probes (Liveness, Readyness, Startup) Introduction
Kubernetes Probes (Liveness, Readyness, Startup) IntroductionAkhmadZakiAlsafi
 
Service Discovery In Kubernetes
Service Discovery In KubernetesService Discovery In Kubernetes
Service Discovery In KubernetesKnoldus Inc.
 
Docker and Kubernetes 101 workshop
Docker and Kubernetes 101 workshopDocker and Kubernetes 101 workshop
Docker and Kubernetes 101 workshopSathish VJ
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetesrajdeep
 
Intro to Helm for Kubernetes
Intro to Helm for KubernetesIntro to Helm for Kubernetes
Intro to Helm for KubernetesCarlos E. Salazar
 
Kubernetes #4 volume &amp; stateful set
Kubernetes #4   volume &amp; stateful setKubernetes #4   volume &amp; stateful set
Kubernetes #4 volume &amp; stateful setTerry Cho
 
Google cloud functions
Google cloud functionsGoogle cloud functions
Google cloud functionsPéter Nagy
 
Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)Idan Atias
 
Kubernetes
KubernetesKubernetes
Kuberneteserialc_w
 

Mais procurados (20)

DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to Kubernetes
 
KubeCon EU 2016: Kubernetes Storage 101
KubeCon EU 2016: Kubernetes Storage 101KubeCon EU 2016: Kubernetes Storage 101
KubeCon EU 2016: Kubernetes Storage 101
 
Kubernetes PPT.pptx
Kubernetes PPT.pptxKubernetes PPT.pptx
Kubernetes PPT.pptx
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive Overview
 
Getting started with kubernetes
Getting started with kubernetesGetting started with kubernetes
Getting started with kubernetes
 
Autoscaling in Kubernetes
Autoscaling in KubernetesAutoscaling in Kubernetes
Autoscaling in Kubernetes
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Introduction to the Container Network Interface (CNI)
Introduction to the Container Network Interface (CNI)Introduction to the Container Network Interface (CNI)
Introduction to the Container Network Interface (CNI)
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Kubernetes Probes (Liveness, Readyness, Startup) Introduction
Kubernetes Probes (Liveness, Readyness, Startup) IntroductionKubernetes Probes (Liveness, Readyness, Startup) Introduction
Kubernetes Probes (Liveness, Readyness, Startup) Introduction
 
Service Discovery In Kubernetes
Service Discovery In KubernetesService Discovery In Kubernetes
Service Discovery In Kubernetes
 
Docker and Kubernetes 101 workshop
Docker and Kubernetes 101 workshopDocker and Kubernetes 101 workshop
Docker and Kubernetes 101 workshop
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Intro to Helm for Kubernetes
Intro to Helm for KubernetesIntro to Helm for Kubernetes
Intro to Helm for Kubernetes
 
Kubernetes #4 volume &amp; stateful set
Kubernetes #4   volume &amp; stateful setKubernetes #4   volume &amp; stateful set
Kubernetes #4 volume &amp; stateful set
 
Google cloud functions
Google cloud functionsGoogle cloud functions
Google cloud functions
 
Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Kubernetes
KubernetesKubernetes
Kubernetes
 

Semelhante a Kubernetes #6 advanced scheduling

Kubernetes Webinar Series - Exploring Daemon Sets and Jobs
Kubernetes Webinar Series - Exploring Daemon Sets and JobsKubernetes Webinar Series - Exploring Daemon Sets and Jobs
Kubernetes Webinar Series - Exploring Daemon Sets and JobsJanakiram MSV
 
Everything you ever needed to know about Kafka on Kubernetes but were afraid ...
Everything you ever needed to know about Kafka on Kubernetes but were afraid ...Everything you ever needed to know about Kafka on Kubernetes but were afraid ...
Everything you ever needed to know about Kafka on Kubernetes but were afraid ...HostedbyConfluent
 
Implement Advanced Scheduling Techniques in Kubernetes
Implement Advanced Scheduling Techniques in Kubernetes Implement Advanced Scheduling Techniques in Kubernetes
Implement Advanced Scheduling Techniques in Kubernetes Kublr
 
OpenShift.io on Gluster
OpenShift.io on GlusterOpenShift.io on Gluster
OpenShift.io on Glustermountpoint.io
 
Kubernetes Summit 2020 - DevOps: Where is My PodPod
Kubernetes Summit 2020 - DevOps: Where is My PodPodKubernetes Summit 2020 - DevOps: Where is My PodPod
Kubernetes Summit 2020 - DevOps: Where is My PodPodsmalltown
 
Spark Gotchas and Lessons Learned
Spark Gotchas and Lessons LearnedSpark Gotchas and Lessons Learned
Spark Gotchas and Lessons LearnedJen Waller
 
Spark Gotchas and Lessons Learned (2/20/20)
Spark Gotchas and Lessons Learned (2/20/20)Spark Gotchas and Lessons Learned (2/20/20)
Spark Gotchas and Lessons Learned (2/20/20)Jen Waller
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes IntroductionMiloš Zubal
 
SolrCloud in Public Cloud: Scaling Compute Independently from Storage - Ilan ...
SolrCloud in Public Cloud: Scaling Compute Independently from Storage - Ilan ...SolrCloud in Public Cloud: Scaling Compute Independently from Storage - Ilan ...
SolrCloud in Public Cloud: Scaling Compute Independently from Storage - Ilan ...Lucidworks
 
Cassandra - A Decentralized Structured Storage System
Cassandra - A Decentralized Structured Storage SystemCassandra - A Decentralized Structured Storage System
Cassandra - A Decentralized Structured Storage SystemVarad Meru
 
Kubecon shanghai rook deployed nfs clusters over ceph-fs (translator copy)
Kubecon shanghai  rook deployed nfs clusters over ceph-fs (translator copy)Kubecon shanghai  rook deployed nfs clusters over ceph-fs (translator copy)
Kubecon shanghai rook deployed nfs clusters over ceph-fs (translator copy)Hien Nguyen Van
 
Real-time analytics with Druid at Appsflyer
Real-time analytics with Druid at AppsflyerReal-time analytics with Druid at Appsflyer
Real-time analytics with Druid at AppsflyerMichael Spector
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfssuser705051
 
Scaling Up Logging and Metrics
Scaling Up Logging and MetricsScaling Up Logging and Metrics
Scaling Up Logging and MetricsRicardo Lourenço
 
Kubernetes Me this Batman
Kubernetes Me this BatmanKubernetes Me this Batman
Kubernetes Me this BatmanSonatype
 

Semelhante a Kubernetes #6 advanced scheduling (20)

Kubernetes Webinar Series - Exploring Daemon Sets and Jobs
Kubernetes Webinar Series - Exploring Daemon Sets and JobsKubernetes Webinar Series - Exploring Daemon Sets and Jobs
Kubernetes Webinar Series - Exploring Daemon Sets and Jobs
 
Everything you ever needed to know about Kafka on Kubernetes but were afraid ...
Everything you ever needed to know about Kafka on Kubernetes but were afraid ...Everything you ever needed to know about Kafka on Kubernetes but were afraid ...
Everything you ever needed to know about Kafka on Kubernetes but were afraid ...
 
Implement Advanced Scheduling Techniques in Kubernetes
Implement Advanced Scheduling Techniques in Kubernetes Implement Advanced Scheduling Techniques in Kubernetes
Implement Advanced Scheduling Techniques in Kubernetes
 
OpenShift.io on Gluster
OpenShift.io on GlusterOpenShift.io on Gluster
OpenShift.io on Gluster
 
Linux Internals - Part III
Linux Internals - Part IIILinux Internals - Part III
Linux Internals - Part III
 
Kubernetes Summit 2020 - DevOps: Where is My PodPod
Kubernetes Summit 2020 - DevOps: Where is My PodPodKubernetes Summit 2020 - DevOps: Where is My PodPod
Kubernetes Summit 2020 - DevOps: Where is My PodPod
 
Spark Gotchas and Lessons Learned
Spark Gotchas and Lessons LearnedSpark Gotchas and Lessons Learned
Spark Gotchas and Lessons Learned
 
Demystifying kubernetes
Demystifying kubernetesDemystifying kubernetes
Demystifying kubernetes
 
Spark Gotchas and Lessons Learned (2/20/20)
Spark Gotchas and Lessons Learned (2/20/20)Spark Gotchas and Lessons Learned (2/20/20)
Spark Gotchas and Lessons Learned (2/20/20)
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
SolrCloud in Public Cloud: Scaling Compute Independently from Storage - Ilan ...
SolrCloud in Public Cloud: Scaling Compute Independently from Storage - Ilan ...SolrCloud in Public Cloud: Scaling Compute Independently from Storage - Ilan ...
SolrCloud in Public Cloud: Scaling Compute Independently from Storage - Ilan ...
 
Cassandra - A Decentralized Structured Storage System
Cassandra - A Decentralized Structured Storage SystemCassandra - A Decentralized Structured Storage System
Cassandra - A Decentralized Structured Storage System
 
Kubecon shanghai rook deployed nfs clusters over ceph-fs (translator copy)
Kubecon shanghai  rook deployed nfs clusters over ceph-fs (translator copy)Kubecon shanghai  rook deployed nfs clusters over ceph-fs (translator copy)
Kubecon shanghai rook deployed nfs clusters over ceph-fs (translator copy)
 
Real-time analytics with Druid at Appsflyer
Real-time analytics with Druid at AppsflyerReal-time analytics with Druid at Appsflyer
Real-time analytics with Druid at Appsflyer
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
 
Terraform-2.pdf
Terraform-2.pdfTerraform-2.pdf
Terraform-2.pdf
 
Scaling Up Logging and Metrics
Scaling Up Logging and MetricsScaling Up Logging and Metrics
Scaling Up Logging and Metrics
 
Kubernetes Me this Batman
Kubernetes Me this BatmanKubernetes Me this Batman
Kubernetes Me this Batman
 
Kubernetes Me This Batman
Kubernetes Me This BatmanKubernetes Me This Batman
Kubernetes Me This Batman
 
OpenDaylight OpenStack Integration
OpenDaylight OpenStack IntegrationOpenDaylight OpenStack Integration
OpenDaylight OpenStack Integration
 

Mais de Terry Cho

Kubernetes #3 security
Kubernetes #3   securityKubernetes #3   security
Kubernetes #3 securityTerry Cho
 
Kubernetes #2 monitoring
Kubernetes #2   monitoring Kubernetes #2   monitoring
Kubernetes #2 monitoring Terry Cho
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 introTerry Cho
 
머신러닝으로 얼굴 인식 모델 개발 삽질기
머신러닝으로 얼굴 인식 모델 개발 삽질기머신러닝으로 얼굴 인식 모델 개발 삽질기
머신러닝으로 얼굴 인식 모델 개발 삽질기Terry Cho
 
5. 솔루션 카달로그
5. 솔루션 카달로그5. 솔루션 카달로그
5. 솔루션 카달로그Terry Cho
 
4. 대용량 아키텍쳐 설계 패턴
4. 대용량 아키텍쳐 설계 패턴4. 대용량 아키텍쳐 설계 패턴
4. 대용량 아키텍쳐 설계 패턴Terry Cho
 
3. 마이크로 서비스 아키텍쳐
3. 마이크로 서비스 아키텍쳐3. 마이크로 서비스 아키텍쳐
3. 마이크로 서비스 아키텍쳐Terry Cho
 
서비스 지향 아키텍쳐 (SOA)
서비스 지향 아키텍쳐 (SOA)서비스 지향 아키텍쳐 (SOA)
서비스 지향 아키텍쳐 (SOA)Terry Cho
 
1. 아키텍쳐 설계 프로세스
1. 아키텍쳐 설계 프로세스1. 아키텍쳐 설계 프로세스
1. 아키텍쳐 설계 프로세스Terry Cho
 
애자일 스크럼과 JIRA
애자일 스크럼과 JIRA 애자일 스크럼과 JIRA
애자일 스크럼과 JIRA Terry Cho
 
REST API 설계
REST API 설계REST API 설계
REST API 설계Terry Cho
 
모바일 개발 트랜드
모바일 개발 트랜드모바일 개발 트랜드
모바일 개발 트랜드Terry Cho
 
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해Terry Cho
 
Micro Service Architecture의 이해
Micro Service Architecture의 이해Micro Service Architecture의 이해
Micro Service Architecture의 이해Terry Cho
 
머신 러닝 입문 #1-머신러닝 소개와 kNN 소개
머신 러닝 입문 #1-머신러닝 소개와 kNN 소개머신 러닝 입문 #1-머신러닝 소개와 kNN 소개
머신 러닝 입문 #1-머신러닝 소개와 kNN 소개Terry Cho
 
R 프로그래밍-향상된 데이타 조작
R 프로그래밍-향상된 데이타 조작R 프로그래밍-향상된 데이타 조작
R 프로그래밍-향상된 데이타 조작Terry Cho
 
R 프로그래밍 기본 문법
R 프로그래밍 기본 문법R 프로그래밍 기본 문법
R 프로그래밍 기본 문법Terry Cho
 
R 기본-데이타형 소개
R 기본-데이타형 소개R 기본-데이타형 소개
R 기본-데이타형 소개Terry Cho
 
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화Terry Cho
 
Redis data modeling examples
Redis data modeling examplesRedis data modeling examples
Redis data modeling examplesTerry Cho
 

Mais de Terry Cho (20)

Kubernetes #3 security
Kubernetes #3   securityKubernetes #3   security
Kubernetes #3 security
 
Kubernetes #2 monitoring
Kubernetes #2   monitoring Kubernetes #2   monitoring
Kubernetes #2 monitoring
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
 
머신러닝으로 얼굴 인식 모델 개발 삽질기
머신러닝으로 얼굴 인식 모델 개발 삽질기머신러닝으로 얼굴 인식 모델 개발 삽질기
머신러닝으로 얼굴 인식 모델 개발 삽질기
 
5. 솔루션 카달로그
5. 솔루션 카달로그5. 솔루션 카달로그
5. 솔루션 카달로그
 
4. 대용량 아키텍쳐 설계 패턴
4. 대용량 아키텍쳐 설계 패턴4. 대용량 아키텍쳐 설계 패턴
4. 대용량 아키텍쳐 설계 패턴
 
3. 마이크로 서비스 아키텍쳐
3. 마이크로 서비스 아키텍쳐3. 마이크로 서비스 아키텍쳐
3. 마이크로 서비스 아키텍쳐
 
서비스 지향 아키텍쳐 (SOA)
서비스 지향 아키텍쳐 (SOA)서비스 지향 아키텍쳐 (SOA)
서비스 지향 아키텍쳐 (SOA)
 
1. 아키텍쳐 설계 프로세스
1. 아키텍쳐 설계 프로세스1. 아키텍쳐 설계 프로세스
1. 아키텍쳐 설계 프로세스
 
애자일 스크럼과 JIRA
애자일 스크럼과 JIRA 애자일 스크럼과 JIRA
애자일 스크럼과 JIRA
 
REST API 설계
REST API 설계REST API 설계
REST API 설계
 
모바일 개발 트랜드
모바일 개발 트랜드모바일 개발 트랜드
모바일 개발 트랜드
 
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
 
Micro Service Architecture의 이해
Micro Service Architecture의 이해Micro Service Architecture의 이해
Micro Service Architecture의 이해
 
머신 러닝 입문 #1-머신러닝 소개와 kNN 소개
머신 러닝 입문 #1-머신러닝 소개와 kNN 소개머신 러닝 입문 #1-머신러닝 소개와 kNN 소개
머신 러닝 입문 #1-머신러닝 소개와 kNN 소개
 
R 프로그래밍-향상된 데이타 조작
R 프로그래밍-향상된 데이타 조작R 프로그래밍-향상된 데이타 조작
R 프로그래밍-향상된 데이타 조작
 
R 프로그래밍 기본 문법
R 프로그래밍 기본 문법R 프로그래밍 기본 문법
R 프로그래밍 기본 문법
 
R 기본-데이타형 소개
R 기본-데이타형 소개R 기본-데이타형 소개
R 기본-데이타형 소개
 
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화
 
Redis data modeling examples
Redis data modeling examplesRedis data modeling examples
Redis data modeling examples
 

Último

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 

Último (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 

Kubernetes #6 advanced scheduling

  • 2. Agenda ● Taint & toleration ● Node affinity ● Pod Affinity ● TopologyKey
  • 3. Taint and toleration Taints ● It allows rejecting deployment of pods to certain node by adding taints to node. (ex : Master node) ● Format : <key>=<value>:<effect> ● Taints effect ○ NoSchedule: Pod won’t be scheduled to the node if they don’t tolerate the taint ○ PreferNoSchedule: It is soft version of Noschedule, meaning the scheduler will try to avoid scheduling the pod to the node, but will schedule it to the node if it can’t schedule it somewhere else ○ NoExecute: Pod is evicted from the node if it is already running on the node, and is not scheduled onto the node if it is not yet running on the node. ■ tolerationSeconds : if this pod is running and a matching taint is added to the node, then the pod will stay bound to the node for 3600 seconds, and then be evicted. If the taint is removed before that time, the pod will not be evicted. (Toration의 효과를 적용 받는 기간, 이 기간이 지나면, toration 효과가 없어지 고, 해당 Pod는 evit/제거 된다.)
  • 4. Taint and toleration Taints ● Command ○ kubectl taint nodes [NODE_NAME] [KEY]=[VALUE]:[EFFECT] ○ kubectl taint nodes node1 key=value:NoSchedule ○ kubectl taint node -l myLabel=X dedicated=foo:PreferNoSchedule
  • 5. Taint and toleration Toleration ● It is applied to Pod and allows the pods to be deployed to node with matching taints ● Exceptional case
  • 6. Taint and toleration Source : https://livebook.manning.com/#!/book/kubernetes-in-action/chapter-16/section-16-3-1
  • 7. Node affinity ● cf. node selector : it specifies that pod should only be deployed on nodes that matched label (Hard affinity) ● Affinity ○ Provide scheduling affinity to node based on label ○ Compared to node selector ■ It can provide “soft/preference” based affinity. (cf. node selector is hard affinity = must) ■ Label selection is more expressive (not just “AND of exact match”)
  • 8. Node affinity Node affinity (beta in 1.10) ● Hard affinity : requiredDuringSchedulingIgnoredDuringExecution Same as node selector (but more expressive node selection syntax) ● Soft affinity : preferredDuringSchedulingIgnoredDuringExecution Try to deploy pod to node that matches selector but if it is not possible the deploy it elsewhere pod-with-node-affinity.yaml docs/concepts/configuration apiVersion: v1 kind: Pod metadata: name: with-node-affinity spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/e2e-az-name operator: In values: - e2e-az1 - e2e-az2 preferredDuringSchedulingIgnoredDuringExecution: - weight: 1 preference: matchExpressions: - key: another-node-label-key operator: In values: - another-node-label-value containers: - name: with-node-affinity image: k8s.gcr.io/pause:2.0 Label key in node is “kubernetes.io/e2e-az-name” and whose value is either e2e-az1 or e2e-az2 In addition, among nodes that meet that criteria, nodes with a label whose key is another-node-label-key and whose value is another-node-label-value should be preferred. From : https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
  • 9. Node affinity Node affinity & Selector-SpreadPriority ● If you create 5 pods with affinity in 2 node cluster, all 5 pods should be created in an node But 1 of 5 pod is created in node 2. The reason is that besides the node affinity prioritization function, the Scheduler also uses other prioritization functions that to decide where to schedule Pod. Selector-SpreadPriority function, which makes sure pods belonging to the same ReplicaSet are spread around different nodes so a node failure won’t bring the wole service down. (Reference : Kubernetes in Action/Manning Chapter 16 page 468)
  • 10. Pod affinity Inter pod affinity (beta in 1.10) ● Node affinity : affinity between pod and node ● Pod affinity : give affinity between Pods themselves based on label of pod which is already running (Same node or Different node) ● Like node affinity , it has two affinity (Hard/Soft) ○ (Hard) requiredDuringSchedulingIgnoredDuringExecution ○ (Soft) preferredDuringSchedulingIgnoredDuringExecution ● It needs to specify topologyKey and labelSelector ● Use case ○ Run db pod in same rack of backend server ○ Run front server in same zone of backend server ○ Run clustered instances in different nodes
  • 11. Pod affinity Inter pod affinity example apiVersion: v1 kind: Pod metadata: name: with-pod-affinity spec: affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: security operator: In values: - S1 topologyKey: failure-domain.beta.kubernetes.io/zone podAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: security operator: In values: - S2 topologyKey: kubernetes.io/hostname containers: - name: with-pod-affinity image: k8s.gcr.io/pause:2.0 Pod (with-pod-affinity) Label selector Hard : “S1” in “security” Label selector Soft/(Weight=100) : “S2” in “security” topologyKey : kubernetes.io/hostname Pod-1 Label = S1:”security” Pod=2 Label = S1:”security”,S2:”securit y” Pod=3 Label = S1:”non-secure”, S2:”security” Node 1 hostname=server1 Node 2 hostname=server2 Node 3 hostname=server2 Top priority 2nd priority Will not selected (it doesn’t meet hard requirement)
  • 12. Pod affinity Pod Anti-Affinity Deploy pod with different place. Use podAntiAffinity instead of podAffinity apiVersion: extensions/v1beta1 kind: Deployment metadata: name: frontend spec: replicas: 5 template: … spec: Affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - topologyKey: kubernetes.io/hostname labelSelector: matchLabels: app: backend Ref : Kubernetes in action book 475
  • 13. Pod affinity Pod Anti-Affinity As you can see, only two pods were scheduled—one to node1, the other to node2. The three remaining pods are all Pending, because the Scheduler isn’t allowed to schedule them to the same nodes. Ref : Kubernetes in action book 475
  • 14. Pod affinity & topologyKey topologyKey ● Key for node label ● Node affinity is just used to select same node. Pod affinity can be used to select same node with the pod. TopologyKey extends place concept like from same node to same rack, same zone, same region. ● How it works When the scheduler is deciding where to deploy a pod based on affinity setting, it find out node based on affinity and get topologyKey value from the node. And the pod will be deployed to one of nodes that has the matched “toplogyKey” value (Pod 배포시 Affinity에 의해서 배포될 노드를 먼저 계산하고, 그 노드의 topologyKey를 얻은 후에, 그 toplogyKey에 해당하는 라벨을 가진 노드에 배포한다.)
  • 15. Pod affinity & topologyKey topologyKey example Node-1 Label = zone:z1 Node-2 Label = zone:z1 Node-3 Label = zone:z1 Node-4 Label = zone:z2 Node-5 Label = zone:z2 Node-6 Label = zone:z2 Pod Label = app:mongodb Pod (node.js) Label selector : app=mongodb topologyKey : zone Assume that pod(node.js) has affinity with label selector app=mongodb. The matched pod is running on Node-2. pod(node.js) has “zone” as a topologykey. So pod(node.js) get the zone value “z1” from Node-2. Based on the value, pod2 will select one of node which has zone=z1 (Node-1,Node-2,Node- 3)
  • 16. Pod affinity & topologyKey topologyKey Examples Reference : https://medium.com/kokster/scheduling-in-kubernetes-part-2-pod-affinity- c2b217312ae1

Notas do Editor

  1. NoSchedule :이 오염을 용인하지 않는 포드는 노드에서 예약되지 않습니다. PreferNoSchedule : Kubernetes는 노드에이 오염을 용인하지 않는 포드 일정을 피합니다. NoExecute : 노드가 이미 노드에서 실행 중이면 노드에서 제거되고 노드에서 노드가 아직 실행되지 않은 경우 노드에 예약되지 않습니다. 마스터 노드에는 아무 Pod나 배포 되면 안되기 때문에, Taints를 설정한다.
  2. NoSchedule :이 오염을 용인하지 않는 포드는 노드에서 예약되지 않습니다. PreferNoSchedule : Kubernetes는 노드에이 오염을 용인하지 않는 포드 일정을 피합니다. NoExecute : 노드가 이미 노드에서 실행 중이면 노드에서 제거되고 노드에서 노드가 아직 실행되지 않은 경우 노드에 예약되지 않습니다. 마스터 노드에는 아무 Pod나 배포 되면 안되기 때문에, Taints를 설정한다.
  3. Pod에 tolerations를 정해놓고, toleration이 매칭되는 node에 pod가 배포 되도록 함.