-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathsession-63.txt
More file actions
118 lines (85 loc) · 4.13 KB
/
Copy pathsession-63.txt
File metadata and controls
118 lines (85 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
PV
PVC
StorageClass
Statefulset vs Deployment
headless service
selectors -> how you control the pod scheduling. Scheduler in Master node
nodeSelector
taints and tolerations
we can assign labels to the nodes, and ask scheduler to select the node based on this label.
alpha.eksctl.io/cluster-name=roboshop,
alpha.eksctl.io/nodegroup-name=spot,
beta.kubernetes.io/arch=amd64,
beta.kubernetes.io/instance-type=c5.large,
beta.kubernetes.io/os=linux,
eks.amazonaws.com/capacityType=SPOT,
eks.amazonaws.com/nodegroup-image=ami-00b16894e17387eb9,
eks.amazonaws.com/nodegroup=spot,
eks.amazonaws.com/sourceLaunchTemplateId=lt-076a33d8f5ddc65cc,
eks.amazonaws.com/sourceLaunchTemplateVersion=1,
failure-domain.beta.kubernetes.io/region=us-east-1,
failure-domain.beta.kubernetes.io/zone=us-east-1c,
k8s.io/cloud-provider-aws=d573a2d478e01899d878f9c9cc3fcc2a,
kubernetes.io/arch=amd64,
kubernetes.io/hostname=ip-192-168-22-49.ec2.internal,
kubernetes.io/os=linux,
node.kubernetes.io/instance-type=c5.large,
topology.k8s.aws/zone-id=use1-az4,
topology.kubernetes.io/region=us-east-1,
topology.kubernetes.io/zone=us-east-1c
kubectl label nodes ip-192-168-22-49.ec2.internal project=roboshop
when pods will go to pending state
1. if there is no resources available on the node
2. if pod is not able to mount the volume
taints and tolerations
=====================
if you taint the node, k8s will not schedule any pod on to that node.
1. project specific hardware. GPU
2. any specific workloads like database accept only from specific ip
if we want our pod on to tainted node, then we should use toleration, toleration will not gaurentee pod scheduling
1. we need to select the node
2. toleration acts as exception/reservation to that node
NoSchedule -> incoming pods no schedule
NoExecute -> running pods should be evicted
kubectl taint nodes ip-192-168-22-49.ec2.internal project=roboshop:NoExecute
running pods in this node will be evicted.
NodeAffinity
=============
NodeSelector does not have much options, just key value pairs. but affinity have more options. we can have operators In, Exist, NotExist, etc...
requiredDuringSchedulingIgnoredDuringExecution -> Hard Rule. labels should match otherwise pod can't be scheduled
preferredDuringSchedulingIgnoredDuringExecution -> Soft rule. if label selectors are not match, k8 considers another node to schedule
1a 1b 1c 1d
1a 1b
what is topology.kubernetes.io/zone=us-east-1c
============
we are telling k8 to consider this zone as border
alpha.eksctl.io/cluster-name=roboshop,alpha.eksctl.io/nodegroup-name=spot,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/instance-type=c5.large,beta.kubernetes.io/os=linux,eks.amazonaws.com/capacityType=SPOT,eks.amazonaws.com/nodegroup-image=ami-00b16894e17387eb9,eks.amazonaws.com/nodegroup=spot,eks.amazonaws.com/sourceLaunchTemplateId=lt-076a33d8f5ddc65cc,eks.amazonaws.com/sourceLaunchTemplateVersion=1,failure-domain.beta.kubernetes.io/region=us-east-1,failure-domain.beta.kubernetes.io/zone=us-east-1c,k8s.io/cloud-provider-aws=d573a2d478e01899d878f9c9cc3fcc2a,kubernetes.io/arch=amd64,kubernetes.io/hostname=ip-192-168-22-49.ec2.internal,kubernetes.io/os=linux,node.kubernetes.io/instance-type=c5.large,project=roboshop,topology.k8s.aws/zone-id=use1-az4,topology.kubernetes.io/region=us-east-1,topology.kubernetes.io/zone=us-east-1c
39-136 -> project = amazon
22-49 -> project = roboshop
1d-2
1c-1
taints
tolerations
we select the node using below strategies
node affinity
node anti affinity
requiredDuringSchedulingIgnoredDuringExecution
preferredDuringSchedulingIgnoredDuringExecution
Pod Affinity
============
backend cache
1. backend and cache in same node
2. backend and cache in diff node
backend and cache -> affinity
I want high available, I want 3 replicas
backend -> backend -> anti-affinity
cache -> cache -> anti-affinity
nodeSelector -> simply selecting the node based on labels
nodeAffinity/nodeAntiAffinity -> improved version of nodeSelector
podAffinity -> affinity towards pods
podAntiAffinity -> repel towards pods
requiredDuringSchedulingIgnoredDuringExecution
preferredDuringSchedulingIgnoredDuringExecution
taint and tolerations
scheduler will schedule -> node executes the pod
4 boxes