Repository navigation
Expand file tree
/
Copy pathsession-71.txt
More file actions
174 lines (122 loc) · 3.53 KB
/
Copy pathsession-71.txt
File metadata and controls
174 lines (122 loc) · 3.53 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
InitContainers
How can they fetch secrets
Networking -> VPC CNI
PDG
TopologyConstraints
Deployment, hpa
min -> 2nodes
min replicas -> 2
node-1 in us-east-1a -> 2 pods
node-2 in us-east-1b
spread pods across the nodes in HA manner -> topologySpreadConstraint
upgrade
drain
delete pod
autoscaling down
there should be always a minimum number of replicas running in voluntary disruption cases -> PDB
min available = total pods - maximum pods on one node/total pods
3 nodes
5 pods
2:2:1
5-2/5 = 60%
3 nodes
5 pods
2:2:1 -> 60%
node-1 drain -> success
node-2 drain -> success
node-3 drain -> success
2 pods 2 nodes
node-1 ->1 pod -> 2 pods
node-2 ->2nd pod -> 2 pods
node-1 drain -> fail
min 3 nodes 1:1:1 -> topologySpreadConstraint
2 zones ->
2 pods -> 1 pod 1st zone, 2nd pod another zone
3 pods -> 2 pods 1st zone, 3rd pod 2nd zone -> maxSkew -> 1pod
4 nodes
zone-1 -> 2 nodes
zone-2 -> 2 nodes
4 replicas
2 pods in zone-1 -> 1st pod in node-1 and 2nd pod in node-2
2 pods in zone-2 -> 3rdt pod in node-3 and 4th pod in node-4
7 pods 2 nodes
max pods -> 4
node-1 -> 4
node-2 -> 3 -> down
4/7 -> 50. != 60
3 nodes 5 pods
2:2:1
k8 architecture
================
control plane
============
1. api server -> entrypoint for everything, checks authentication and authorization, call another components
2. scheduler -> schedules the pod on available node, node resources, node selectors, affinity, anti affinity, taints and toleration, topologySpreadConstraint, etc.. it always checks pending pods can be scheduled or not
3. control manager
replica/deployment controller -> always checks desired number of replicas running or not
Node controller: desired number of nodes are always up
EndpointSlice controller: always populates pod ips to service endpoints
ServiceAccount controller: Create default ServiceAccounts for new namespaces.
4. etcd -> memory for k8s cluster, manifest files, config maps, secrets, etc... key-value pair database
5. cloud-controller-manager -> cloud specific api handle
node components
===========
kubelet -> always in contact with api-server, it is like agent running in every node. node health status report sends to control plane, responsible to run the pods in node
kube-proxy -> manages networking rules to bring traffic to pods, iptables management
Container runtime -> containerd is the run time...
Addons
======
namespaces
pod
service
configmap
secrets
pv, pvc, sc
taints and tolerations
affinity and anti affinity
replicaset
deployment
statefulset
deamonset
rbac
ingress
volumes
network policies
pdb and topologySpreadConstraint
upgrade cluster
blue green deployments
hpa
helm charts
blue -> 1.34
green -> 1.35
8 nodes
2 nodes
taints and toleration and affinity -> 2 nodes
topologySpreadConstraint -> topologyKey is host, topologyKey zone and host
GIT
====
1. repo creation
2. adding to staging area, commit to local repo
3. push to central repo
git init
git branch -M main -> create and move to main
git remote add origin <url> -> connect to central repo
git pull
branches
========
dev sit/uat/qa prod
main -> prod ->
create another branch, do the changes, test it and then push to main
PR -> when you bring change from another branch to main branch
merge
=====
1. you got extra commit, it is special commit it has 2 parents, merge commit
2. it is preserving history
rebase
=====
git branch -M main -> creating main and main branch
git checkout -b karam-dosa -> create new branch karam-dosa and move inside to it
it will not preserve any history
it is linear history
seems like main branch moved forward
it is rewriting commits