-
Notifications
You must be signed in to change notification settings - Fork 0
/
K8s Concepts
158 lines (111 loc) · 3.55 KB
/
K8s Concepts
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
K8s Concepts:
=============
Node:
=====
- Worker machine in K8s know as Minion
- Physical or VM depending on the cluster
- Contains necessary components to run PODS and is managed by master components
- Services in Node include
- Container Runtime
- kubelet
- kubeproxy
Controller:
============
- Master component
- Manages various aspects of nodes
- Monitors Node health
- Create and manage multiple PODS for you
Self Registration of nodes:
---------------------------
--register-node , kubelet will attempt to register itself with the API Server
--kubeconfig
Master Node Communication:
==========================
- Comms between cluster to master terminate at the API Server
- Master components communicate with the cluster apiserver over secure port
Master to Cluster:
===================
API Server => kubelet
API Server => Node,POD or Service through API server's proxy functionality
POD:
=====
- Simplest unit of execution
- Group of one or more containers with shared storage/Network and a spec to run the containers.
- Application contianers that are tightly coupled
- Docker is most common container runtime used in a K8s POD
- Types of PODS
- PODS with single containers
- PODS with multiple Containers
- Each POD is meant to run a single instance of the given application
- Scale Horizontally => Use multiple PODS
- Replication is done by the Controller
- Two kinds of shared resources
- Networking - Unique IP Address per POD
- Storage
* Shared Storage volumes
* Containers in the POD can access the shared volumes allowing them to share data
- Pods don't self heal
- Manage PODS using the Controller
POD Templates:
==============
- POD specifications
- Controllers use POD spec to create PODS
apiVersion:v1
kind:Pod
metadata:
name:my-app
labels:
app:myapp
spec:
containers:
- name: myapp-Controller
image:BusyBox
command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600']
POD Lifecycle:
===============
Pending => Running <=> Failed <=> Succeeded <=> Unknown
Scheduler:
==========
- Scheduler decides which pod goes on which node
- Doesn't place the pod itself
- kubelet does the placing of the pod in node
- Scheduler does the matching with the best resources in the node
- Rank Nodes
- Free Resources once we place the POD
ETCD:
=====
- Distributed K:V store
- ETCD stores info about
- Listens in port 2379
- Nodes
- PODS
- Configs
- Secrets
- Accounts
- Roles
- Bindings
API Server:
===========
- Scheduler continuously monitors the API server with pod with no node assigned
- Scheduler identifies the right node to place the POD
- Authenticate User
- Validate Request
- Retrieve data
- Update ETCD
- Scheduler
- Kubelet
Kubelet:
=========
Register the node in the K8s cluster
Create PODS
Monitors Nodes and PODS
Kubeadm doesn't deploy Kubelet
ps -aux | grep Kubelet
Kube Proxy:
===========
- POD Network is the internal network connecting all nodes in the cluster
- internal comms is done using a Service
- Communication between various services in the cluster
- Kube-proxy runs on each node
- Look for new Services and direct traffic from the POD through that Service
- IP Table rules