-
Notifications
You must be signed in to change notification settings - Fork 3
/
Day3.txt
394 lines (330 loc) · 8.56 KB
/
Day3.txt
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
13.233.201.13
centos
centos123
========================
https://www.devopsschool.com/tutorial/docker/commands/index.html
Docker Commands - Working with Registry/Repository
-----------------
Command Description
login Log in to a Docker registry
logout Log out from a Docker registry
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
search Search the Docker Hub for images
------------------------
Docker Volume
Docker networking
Docker Compose
Kubernetes
=====================================================
How to share your developed image?
- Using Tar Ball
15 docker images
16 docker save -o first.tar first
17 ls
18 docker rmi first
19 clear
20 docker images
21 ls
22 docker load -i first.tar
23 docker images
24 clear
25 ls
26 docker images
27 docker run -itd first
28 docker
29 clear
30 docker ps
- Using Registry
- PUBLIC
hub.docker.com DONE
google registry
Azure repos
ECR
- PRIVATE - Hosted
Artifactory
nexus
Docker Registry
hub.docker.com
---------------------
Step 1- Register and verify your free account @hub.docker.com [ 1 PVT REPO + UNLIMUTED PUB REPO]
Step 2- Create a EMPTRY repos @hub.docker.com
Step 3- Create one image in local
Step 4- Make sure that Name of [email protected] ==== name of repo @local
Step 5- docker login
Step 6- docker push imagename
Step 7- docker logout
26 docker images
27 docker run -itd first
28 docker
29 clear
30 docker ps
31 history
32 clear
33 docker images
34 clear
35 ls
36 docker images
37 docker tag first devopsschools/jan2021
38 docker images
39 docker login
40 docker info
41 clear
42 docker login
43 docker images
44 docker login
45 more /root/.docker/config.json.
46 more /root/.docker/config.json
47 clear
48 ls
49 more /root/.docker/config.jsonclear
50 clear
51 ls
52 docker images
53 docker push devopsschools/jan2021
54 clear
55 docker images
56 docker tag devopsschools/jan2021 devopsschools/jan2021:v2
57 docker images
58 docker push devopsschools/jan2021:v2
59 docker logout
====================================================
How to have data persistency BEYOND a lifecycle of the Container.
---
Container is deleted -- data of the container should not deleted.
--------------------------------
Ans - Volume - Docker Volume
TYPES of DRIVER
======================
- volume = /var/lib/docker/volumes
- mountfs = ANY WHERE in the HOST MOUNT
- tempfs = memory
https://www.devopsschool.com/blog/understand-docker-volume-from-beginner-to-deep-dive-level/
96 cd /var/lib/docker/volumes/
97 ls
98 pwd
99 clear
100 ls
101 docker volume
102 clear
103 docker volume ls
104 docker volume create dev
105* docker volume l
106 ls
107 cd dev/
108 ls
109 cd _data/
110 ls
111 clear
112 cd ../..
113 ls
114 docker volume create qa
115 docker volume rm dev
116* l
117 docker volume ls
118 docker volume prune
119 ls
120 docker volume prune
121 clear
122 ls
123 history
122 ls
123 history
124 clear
125 docker volume
126 clear
127 ls
128 docker volume create dev
129 ls
130 docker run -itd -v devubuntu
131 clear
132 docker run -itd -v dev:/opt/raju ubuntu
133 docker ps
134 docker exec fef28c222bd9 df -kh
135 clear
136 docker exec fef28c222bd9 touch /opt/raju/devopsschool.txt
137 docker exec fef28c222bd9 ls /opt/raju
138 ls
139 cd dev/
140 clear
141 ls
142 cd _data/
143 ls
144 touch docker.txt
145 ls
146 docker exec fef28c222bd9 ls /opt/raju
147 clear
148 cd ../..
149 ls
150 docker run -itd -v dev:/tmp/raju ubuntu
151 docker ps
152 docker exec 4543a8c0ccd4 df -kh
153 docker exec 4543a8c0ccd4 ls /tmp/raju
154 clear
155 ls
156 history
157 cleart
158 clear
159 ls
160 docker ps
161 dockers stop 4543a8c0ccd4 fef28c222bd9
162 dockers rm 4543a8c0ccd4 fef28c222bd9
163 docker rm 4543a8c0ccd4 fef28c222bd9
164 cear
165 clear
166 docker stop 4543a8c0ccd4 fef28c222bd9
167 docker rm 4543a8c0ccd4 fef28c222bd9
168 docker ps -a
169 clear
170 ls
171 cd dev/
172 ls
173 cd _data/
174 ls
175 pwd
176 ls
177 cd /opt/
178 clear
179 ls
180 mkdir backup
181 cd backup/
182 pwd
183 docker run -itd -v /opt/backup:/opt/rajesh ubuntu
184 docker ps
185 docker exec 979e4e599046 df -kh
186 clear
187 docker run -itd -v /opt/backup:/opt/rajesh -v dev:/tmp/ddd ubuntu
188 docker ps
189 docker exec b7e8e19f6c55 /tmp/
190 docker exec b7e8e19f6c55 ls/tmp/
191 docker exec b7e8e19f6c55 ls /tmp/
192 docker exec b7e8e19f6c55 ls /opt/
193 clear
========================================================
Docker Networking === Container Networking
========================================================
Each Container get
ONE NET NS Assigned - default.
More net ns --- YES
===============================================
Networking Driver Types
===============================================
- Bridge
- Host Only
- NONE
197 docker exec b7e8e19f6c55 df -kh
198 clear
199 docker stop $(docker ps -a -q)
200 docker rm $(docker ps -a -q)
201 clear
202 docker ps -a
203 clear
204 ifconfig
205 clear
206 docker network ls
207 ifconfig
208 docker network ls
209 clear
210 docker network ls
211 ifconfig
212 clear
213 docker run -itd ubuntu
214 docker ps
215 ifconfig
216 docker run -itd ubuntu
217 ifconfig
218 docker ps
219 docker stop 3bab7c37d659
220 ifconfig
221 clear
222 ls
223 docker network ls
224 docker network
225 docker network inspect 2142c2330450
226 docker ps
227 docker inspect 01fdb8ca3ebe
228 clear
229 docker network ls
230 docker network
231 docker network create dev
232 clear
233 docker network create qa
234 docker network ls
235 docker inspect eed4f42a7b1e
236 clear
237 ls
238 docker network ls
239 docker run -itd --net=dev ubuntu
240 docker ps
241 docker inspect 2594fe153eae
242 docker ps
243 clear
244 docker network ls
245 docker ps
246 docker network connect 01fdb8ca3ebe dev
247 docker network connect dev 01fdb8ca3ebe
248 docker inspect 01fdb8ca3ebe
249 docker network disconnect dev 01fdb8ca3ebe
250 docker inspect 01fdb8ca3ebe
251 clear
252 ls
253 docker ps
254 docker network connect dev 01fdb8ca3ebe
255 docker attach 01fdb8ca3ebe
256 clear
257 ls
258 history
259 docker network ls
260 docker run -itd --net=host ubuntu
261 clear
262 docker ps
263 ifconfig
======================================================================================
======================================================================================
Manual Way using Kubeadm
===================================
Master Aka Control Plane
-----------------------
API server -> POD -> Container -> Docker Image -> Google Registry
Etcd -> POD -> Container -> Docker Image -> Google Registry
Controller Mgr -> POD -> Container -> Docker Image -> Google Registry
Schedular -> POD -> Container -> Docker Image -> Google Registry
Kube Proxy -> POD -> Container -> Docker Image -> Google Registry
Kubelet
Docker
Kubectl
Kubeadm init
Worker aka Node
-----------------------
Kubelet
Docker
Kubectl
Kube Proxy -> POD -> Container -> Docker Image -> Google Registry
Kubeadm join
Work Station - Laptop
---------------------
Kubectl
===========================================
https://www.devopsschool.com/blog/setting-up-kubernetes-clusters-using-kubeadm-manual-way-in-rhel-7-centos7/
Master + Workstation
----------------
35.154.70.236
centos
Worker
-----------------
13.235.49.223
centos
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 172.31.13.37:6443 --token v2dx9b.2s1xmppwuyn6rshw \
--discovery-token-ca-cert-hash sha256:f4ed723be9516818aacf65da9ceae3b53c96d78c49fe2a37fc78f178a85df4e8
======================
POD RC DEP SERVICE STOR