-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathdiagram-hyperv-topology.html
More file actions
211 lines (190 loc) · 8.19 KB
/
Copy pathdiagram-hyperv-topology.html
File metadata and controls
211 lines (190 loc) · 8.19 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hyper-V Topology — CKA Lab</title>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
max-width: 1400px;
margin: 40px auto;
padding: 0 24px;
background: #f7f7f7;
color: #1a1a1a;
line-height: 1.6;
}
h1 {
border-bottom: 3px solid #1e3a5f;
padding-bottom: 8px;
}
.diagram-container {
background: white;
border-radius: 8px;
padding: 32px;
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
margin: 24px 0;
overflow-x: auto;
}
.key-insight {
background: #fff8dc;
border-left: 4px solid #d4a017;
padding: 16px 24px;
margin: 24px 0;
border-radius: 4px;
}
.key-insight strong {
color: #8b6914;
}
code {
background: #eee;
padding: 2px 6px;
border-radius: 3px;
font-family: "Consolas", "Monaco", monospace;
font-size: 0.92em;
}
.legend {
display: flex;
gap: 24px;
flex-wrap: wrap;
margin: 16px 0;
font-size: 0.9em;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
}
.swatch {
width: 20px;
height: 20px;
border-radius: 4px;
border: 1px solid #333;
}
table {
border-collapse: collapse;
width: 100%;
margin: 16px 0;
}
th, td {
border: 1px solid #ccc;
padding: 10px 12px;
text-align: left;
}
th {
background: #1e3a5f;
color: white;
}
tr:nth-child(even) {
background: #f0f0f0;
}
</style>
</head>
<body>
<h1>Hyper-V Topology — CKA Lab</h1>
<p>Three Ubuntu 22.04 VMs, one isolated Hyper-V internal switch with NAT to the host, three static IPs on a <code>/24</code> subnet. <strong>Internet works (outbound NAT), but nothing from the outside world can reach the VMs.</strong> That's exactly what the CKA exam environment looks like.</p>
<div class="legend">
<div class="legend-item"><div class="swatch" style="background:#5f1e3a"></div><span>Windows host</span></div>
<div class="legend-item"><div class="swatch" style="background:#1e3a5f"></div><span>Hyper-V switch</span></div>
<div class="legend-item"><div class="swatch" style="background:#1e5f3a"></div><span>Control plane VM</span></div>
<div class="legend-item"><div class="swatch" style="background:#5f4e1e"></div><span>Worker VMs</span></div>
</div>
<div class="diagram-container">
<pre class="mermaid">
flowchart LR
INET((Internet)) -.->|"Outbound NAT only"| HOST
subgraph HOST ["<b>Windows 11 host</b><br/>OFFICE-DESKTOP"]
direction TB
PWSH["admin pwsh 7<br/>cka-*.ps1 scripts"]
HYPERV["Hyper-V<br/>(VMM service)"]
SWITCH["<b>CKA-NAT switch</b><br/>internal type<br/>192.168.50.0/24<br/>gateway: 192.168.50.1"]
PWSH --> HYPERV
HYPERV --> SWITCH
end
SWITCH --> CP
SWITCH --> W1
SWITCH --> W2
subgraph CP ["<b>control1</b><br/>192.168.50.10"]
direction TB
CP1["Ubuntu 22.04<br/>2 vCPU / 2 GB RAM"]
CP2["containerd + CRI<br/>kubelet (will host etcd,<br/>apiserver, scheduler, CM<br/>after Module 2 kubeadm init)"]
CP1 --> CP2
end
subgraph W1 ["<b>worker1</b><br/>192.168.50.11"]
direction TB
W1A["Ubuntu 22.04<br/>2 vCPU / 2 GB RAM"]
W1B["containerd + CRI<br/>kubelet (will join cluster<br/>via kubeadm join in M2)"]
W1A --> W1B
end
subgraph W2 ["<b>worker2</b><br/>192.168.50.12"]
direction TB
W2A["Ubuntu 22.04<br/>2 vCPU / 2 GB RAM"]
W2B["containerd + CRI<br/>kubelet (will join cluster<br/>via kubeadm join in M2)"]
W2A --> W2B
end
style HOST fill:#5f1e3a,stroke:#fff,color:#fff
style PWSH fill:#5f1e3a,stroke:#fff,color:#fff
style HYPERV fill:#5f1e3a,stroke:#fff,color:#fff
style SWITCH fill:#1e3a5f,stroke:#fff,color:#fff
style CP fill:#1e5f3a,stroke:#fff,color:#fff
style CP1 fill:#1e5f3a,stroke:#fff,color:#fff
style CP2 fill:#1e5f3a,stroke:#fff,color:#fff
style W1 fill:#5f4e1e,stroke:#fff,color:#fff
style W1A fill:#5f4e1e,stroke:#fff,color:#fff
style W1B fill:#5f4e1e,stroke:#fff,color:#fff
style W2 fill:#5f4e1e,stroke:#fff,color:#fff
style W2A fill:#5f4e1e,stroke:#fff,color:#fff
style W2B fill:#5f4e1e,stroke:#fff,color:#fff
</pre>
</div>
<div class="key-insight">
<strong>Key insight:</strong> The <code>CKA-NAT</code> switch is an <em>internal</em> Hyper-V switch — NOT external, NOT private. <strong>Internal</strong> means: VMs talk to each other and to the host (via the <code>vEthernet (CKA-NAT)</code> adapter on the host at <code>192.168.50.1</code>), and a Windows NAT rule lets them reach the internet outbound. But nothing on your LAN can SSH to <code>192.168.50.10</code> — only the host can. That isolation is by design: the lab can't accidentally collide with your LAN's DHCP range, and your spouse's laptop can't accidentally land a CIDR conflict.
</div>
<h2>Node specs</h2>
<table>
<thead>
<tr><th>Node</th><th>IP</th><th>vCPU</th><th>RAM</th><th>Role</th><th>Future role (Module 2+)</th></tr>
</thead>
<tbody>
<tr><td><code>control1</code></td><td>192.168.50.10</td><td>2</td><td>2 GB</td><td>Control plane</td><td>Hosts etcd, kube-apiserver, kube-scheduler, kube-controller-manager (as static pods), plus kubelet + kube-proxy</td></tr>
<tr><td><code>worker1</code></td><td>192.168.50.11</td><td>2</td><td>2 GB</td><td>Worker</td><td>Joins via <code>kubeadm join</code>; runs kubelet + kube-proxy + workload pods</td></tr>
<tr><td><code>worker2</code></td><td>192.168.50.12</td><td>2</td><td>2 GB</td><td>Worker</td><td>Same as worker1</td></tr>
</tbody>
</table>
<h2>Network specs</h2>
<table>
<thead><tr><th>Setting</th><th>Value</th><th>Why</th></tr></thead>
<tbody>
<tr><td>Switch type</td><td>Internal</td><td>Isolates VMs from LAN; only the host can reach them</td></tr>
<tr><td>Switch name</td><td><code>CKA-NAT</code></td><td>Distinguishes from any other Hyper-V switches you might have (Default Switch, etc.)</td></tr>
<tr><td>Subnet</td><td>192.168.50.0/24</td><td>Unlikely to collide with home LAN ranges (usually 192.168.1.x or 192.168.0.x)</td></tr>
<tr><td>Host gateway IP</td><td>192.168.50.1</td><td>Assigned to <code>vEthernet (CKA-NAT)</code> adapter on Windows; provides NAT exit</td></tr>
<tr><td>NAT rule name</td><td><code>CKA-NAT-Network</code></td><td>Windows NAT (<code>Get-NetNat</code>) translates VM outbound traffic via the host's external NIC</td></tr>
<tr><td>DNS</td><td>8.8.8.8 / 8.8.4.4</td><td>Set by netplan on each VM; lets <code>apt</code> reach <code>pkgs.k8s.io</code></td></tr>
</tbody>
</table>
<h2>How to inspect each layer from the host</h2>
<pre style="background:#000;color:#f5d000;padding:20px;border-radius:6px;overflow-x:auto;font-family:'Consolas','Monaco',monospace;font-size:1.05em;font-weight:600;line-height:1.5;border:2px solid #f5d000;"><code style="background:transparent;color:#f5d000;font-size:1em;"># See the Hyper-V switch
Get-VMSwitch -Name "CKA-NAT"
# See the host adapter for the switch (your gateway end)
Get-NetAdapter -Name "vEthernet (CKA-NAT)"
# See the NAT rule that bridges VMs to the internet
Get-NetNat -Name "CKA-NAT-Network"
# See the 3 VMs themselves
Get-VM | Where-Object { $_.Name -match "control1|worker1|worker2" }
# See where the VHDX files actually live (yours: D:\VMS\)
Get-VMHardDiskDrive -VMName control1, worker1, worker2 | Select-Object VMName, Path
# Quick reachability test
.\cka-info.ps1
</code></pre>
<h2>Disk layout</h2>
<ul>
<li><strong>VHDX storage:</strong> <code>D:\VMS\</code> (set globally via Hyper-V's default VM path; verify with <code>Get-VMHost | Select VirtualMachinePath, VirtualHardDiskPath</code>)</li>
<li><strong>Vagrant metadata:</strong> <code><project>\.vagrant\machines\<vm>\hyperv\</code> — Vagrant's tracking of which Hyper-V VM belongs to which line in the Vagrantfile</li>
<li><strong>Provisioner logs:</strong> on each VM at <code>/var/log/cka-provision.log</code> — timestamped <code>>>></code> step record</li>
</ul>
<script>
mermaid.initialize({ startOnLoad: true, theme: 'default', securityLevel: 'loose', flowchart: { useMaxWidth: true, htmlLabels: true } });
</script>
</body>
</html>