foo
Olaf Bohlen
2023-02-21 e54206c918190341bb361187261620151e98ef0b
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
 
* ISO/OSI Reference Model
 
7 Application Layer    |  firefox web browser    ^
6 Presentation Layer   |  HTML                   |
5 Session Layer        |  HTTP                   |
4 Transport Layer      |  TCP 80                 |
3 Network Layer        |  IP 10.88.0.74          | 
2 Datalink Layer       |  ETH 0:14:4f:c9:85:70   |
1 Physical Layer       v  Copper/Fibre           |
 
People Do Not Throw Sausage Pizza Away
 
#+begin_src ditaa :file packet-content.png :cmdline -E -s 0.8
 
+----------+---
|Eth Frame |Payload
| Header   |+-----------+----
| SRC MAC  || IP Packet |Payload
| DST MAC  || SRC IP    |+-----------+-------
           || DST IP    || TCP Packet| Payload...
                         | SRC Port
                         | DST Port
#+end_src
 
* layers
 
#+begin_src ditaa :file containerimage-layers.png :cmdline -E -s 0.8
     ubi8                      ubi8+apache                  ubi8+apache+php
                                                          +---------------+
                                                          | Instruction 2 |
                             +---------------+            +---------------+
                             | Instruction 1 |          | Instruction 1 |
   +-------------+  Instr1   +---------------+  Instr 2      +---------------+
   | Base Layer  | ------->  | Base Layer    | ---------> | Base Layer    |
   +-------------+           +---------------+            +---------------+
                                 |
                                 |Alt Inst2
                                 v ubi8+apache+ruby
                             +---------------+
                             | Alt Inst 2    |
                             +---------------+
                 | Instruction 1 |
                 +---------------+
                 | Base Layer    |
                              +---------------+
#+end_src
* Container components
 
#+begin_src ditaa :file processlist-containers.png :cmdline -E -s 0.8
 
|
+- 1 systemd
|
+- 42 bash
|
+- 23 vim
|
|---------------+  namespace, chroot, SELinux, cgroups, Seccomp
+- 53 mysql5.5  |
|---------------+
|---------------+  namespace, chroot, SELinux, cgroups, Seccomp
+- 54 mysql5.8  |
|---------------+
+------------+     namespace, chroot, SELinux, cgroups, Seccomp
+- 74 apache |
|------------+
|
+- 122 bash
 
 
#+end_src
 
/container1/usr/sbin/mysqld
/container2/usr/sbin/mysqld
 
chroot /container1 
* UNIX Memory Seperation
 
#+begin_src ditaa :file userland.png :cmdline -E -s 0.8 
 
            +---------------------------------+       Process
Userland    | Proc1, Proc2, ...               |          |
            |                                 |          v
            |                                 |       System Call
            +-----SystemCalls-----------------+          |
            +---------------------------------+          v
Kernel      | Device Driver, Scheduler,       |       Kernel Driver
Space       | Memory Management, ...          |
            +---------------------------------+
#+end_src 
 
* docker vs podman components
 
                                 (root)
docker-cli ---REST (HTTP)---> docker-daemon --> moby --> container
                               [webserver]
 
 (root)
podman   -> CRI-O -> runC -> container
            (Container Runtime Interface - OCI (Open Container Initiative))
 
alias docker=podman
 
 
 
* oc command line tool parameter
 
oc is a modified kubectl, but full compatible 
 
| Command | SubCommand  | Resource Type              | [<Resource Name>] |
|---------+-------------+----------------------------+-------------------|
| oc      | get         | pod                        | [name]            |
| kubectl | describe    | svc / service              |                   |
|         | edit        | all                        |                   |
|         | get -o yaml | replicationcontroller / rc |                   |
|         | get -o json | deploymentconfig / dc      |                   |
|         | delete      | buildconfig / bc           |                   |
|         | create      | imagestream / is           |                   |
|         |             | NetworkPolicy              |                   |
|         |             | project                    |                   |
|         |             | route                      |                   |
 
# oc new-project
# oc new-app
# oc rsh <podname>
 
 
* UNIX Kernel Memory 
 
#+begin_src ditaa :file system_memory.png :cmdline -E -s 0.8 
 
+--------------------------------+
|0Heap                           |
|                                |
|                                |
|                                |
|                                |
|                                |
+--------------------------------+
Gap
+--------------------------------+
|                                |
|                                |
|                                |
|Stack                       2^64|
+--------------------------------+
 
#+end_src