Files
Resume/dist/02-infra-platform-portfolio.html

374 lines
18 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>02-infra-platform-portfolio</title>
<style>:root {
color-scheme: light;
--ink: #17212b;
--muted: #5c6b77;
--rule: #dbe2e7;
--accent: #0f766e;
--accent-dark: #0b5f59;
--soft: #f2f8f7;
--soft-2: #f6f8fa;
--card: #ffffff;
}
@page {
size: 297mm 167mm;
margin: 10mm 14mm 9mm;
}
* { box-sizing: border-box; }
body {
margin: 0;
background: #fff;
color: var(--ink);
font-family: "Noto Sans CJK KR", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
font-size: 9.15pt;
line-height: 1.42;
word-break: keep-all;
overflow-wrap: break-word;
}
main {
width: 100%;
margin: 0 auto;
}
h1, h2, h3 {
margin: 0;
line-height: 1.18;
letter-spacing: -0.015em;
}
/* Each page is exactly the content box, so its figure can flex into the slack. */
.page {
display: flex;
flex-direction: column;
height: 148mm;
overflow: hidden;
}
.page + .page {
break-before: page;
}
.page > h1 {
flex: 0 0 auto;
padding-top: 1mm;
padding-bottom: 2.2mm;
border-bottom: 2px solid var(--accent);
font-size: 21.5pt;
font-weight: 900;
}
.page:first-child > h1 {
margin-top: 3mm;
padding-bottom: 0;
border-bottom: 0;
font-size: 26pt;
color: var(--ink);
}
h2 {
margin-top: 3.4mm;
color: var(--accent-dark);
font-size: 14pt;
font-weight: 850;
}
h3 {
margin-top: 2.5mm;
font-size: 10.8pt;
font-weight: 850;
}
p {
margin: 1.4mm 0;
}
strong { font-weight: 850; }
a {
color: #0b5cad;
text-decoration: none;
}
hr {
height: 1px;
margin: 2.5mm 0;
border: 0;
background: var(--rule);
}
blockquote {
margin: 2mm 0 2.4mm;
padding: 2mm 2.6mm;
border: 0;
border-left: 4px solid var(--accent);
border-radius: 3px;
background: var(--soft);
color: #28433f;
font-size: 9.1pt;
}
blockquote p { margin: 0; }
ul, ol {
margin: 1.3mm 0 2mm;
padding-left: 5mm;
}
li {
margin: .65mm 0;
padding-left: .4mm;
}
code {
padding: .1mm .55mm;
border-radius: 2px;
background: #eef2f4;
color: #23303c;
font-family: "JetBrains Mono", "D2Coding", Consolas, monospace;
font-size: .91em;
}
pre {
margin: 1.8mm 0;
padding: 2mm 2.4mm;
border: 1px solid var(--rule);
border-radius: 5px;
background: var(--soft-2);
white-space: pre-wrap;
}
pre code {
padding: 0;
background: transparent;
font-size: 7.5pt;
line-height: 1.35;
}
table {
width: 100%;
margin: 1.8mm 0 2.3mm;
border-collapse: separate;
border-spacing: 0;
table-layout: fixed;
font-size: 8.0pt;
line-height: 1.32;
}
td {
padding: 1.15mm 1.55mm;
border-right: 1px solid var(--rule);
border-bottom: 1px solid var(--rule);
vertical-align: top;
background: #fff;
}
tr:first-child td {
border-top: 1px solid var(--rule);
font-weight: 800;
color: #34424e;
}
td:first-child { border-left: 1px solid var(--rule); }
tr:first-child td:first-child { border-top-left-radius: 5px; }
tr:first-child td:last-child { border-top-right-radius: 5px; }
tr:last-child td:first-child { border-bottom-left-radius: 5px; }
tr:last-child td:last-child { border-bottom-right-radius: 5px; }
.two-col-table td:first-child {
width: 33mm;
background: #f7f9fa;
color: var(--muted);
font-weight: 800;
}
.metric-table {
border-spacing: 2mm 0;
border-collapse: separate;
margin-top: 2.3mm;
}
.metric-table td {
border: 0;
text-align: center;
background: var(--soft-2);
}
.metric-table tr:first-child td {
border: 0;
padding-top: 2.3mm;
padding-bottom: .8mm;
color: var(--accent-dark);
font-size: 14.5pt;
font-weight: 900;
}
.metric-table tr:last-child td {
padding-top: .7mm;
padding-bottom: 2.3mm;
color: var(--muted);
font-size: 8.0pt;
}
.data-table tr:first-child td {
background: #f3f6f7;
color: #34424e;
font-weight: 850;
}
figure {
display: flex;
flex: 1 1 auto;
flex-direction: column;
justify-content: center;
min-height: 0;
margin: 1.6mm auto;
text-align: center;
}
figure img {
display: block;
max-width: 100%;
max-height: 100%;
min-height: 0;
margin: 0 auto;
object-fit: contain;
}
figcaption {
margin-top: .7mm;
color: var(--muted);
font-size: 6.8pt;
}
.project {
display: block;
}
h2, h3, blockquote, table, figure {
break-after: avoid;
}
tr, blockquote, figure {
break-inside: avoid;
}
/* ── Cover: headline > experience axis > headline results > stack > contact ── */
.page:first-child > h1 {
margin-top: 6mm;
font-size: 34pt;
}
.page:first-child > h1 + h2 {
margin-top: 3.4mm;
max-width: 235mm;
color: var(--accent-dark);
font-size: 18.5pt;
line-height: 1.24;
}
.page:first-child > h1 + h2 + blockquote {
max-width: 235mm;
margin-top: 3.6mm;
padding: 2.6mm 3.2mm;
font-size: 9.6pt;
}
/* Headline results on the cover read louder than anything below them. */
.page:first-child > h1 + h2 + blockquote + .metric-table {
margin-top: 5.5mm;
}
.page:first-child > h1 + h2 + blockquote + .metric-table td {
background: var(--soft);
}
.page:first-child > h1 + h2 + blockquote + .metric-table tr:first-child td {
padding-top: 3.4mm;
padding-bottom: 1.1mm;
font-size: 19pt;
}
.page:first-child > h1 + h2 + blockquote + .metric-table tr:last-child td {
padding-bottom: 3.4mm;
font-size: 8.4pt;
}
/* Stack and contact are the quietest elements on the page. */
.page:first-child > h1 + h2 + blockquote + .metric-table + p {
margin-top: 4.2mm;
color: var(--muted);
font-size: 8.6pt;
}
.page:first-child > h1 + h2 + blockquote + .metric-table + p + .two-col-table {
width: 118mm;
margin-top: 3.4mm;
font-size: 7.8pt;
}
.page:first-child > h1 + h2 + blockquote + .metric-table + p + .two-col-table td {
padding: .85mm 1.4mm;
}
.page:first-child > h1 + h2 + blockquote + .metric-table + p + .two-col-table td:first-child {
width: 26mm;
}
/* ── Section pages ── */
/* The deck line under a section title stays subordinate to the h2 claim. */
h2 + p strong:first-child {
color: #34424e;
}
@media print {
a { color: #0b5cad; }
}
/* ── Figures ──────────────────────────────────────────────────────────────
A figure is the flexible row of its .page column, so it receives exactly the
space the text on that page leaves over and the image scales into it. Width
(269mm of content box) is the binding constraint for wide diagrams, so the
viewBox aspect ratio decides how large the labels inside an SVG end up:
rendered height(mm) = viewBox height / viewBox width * 269
A 1260x450 diagram therefore prints at ~96mm and its 20-unit labels at ~12pt.
Nothing here caps the figure in millimetres; overflow is impossible because
the page box is a fixed 148mm and the figure is the only element that flexes.
------------------------------------------------------------------------ */
figcaption {
flex: 0 0 auto;
margin-top: 1mm;
font-size: 7.2pt;
}
</style>
</head>
<body>
<main>
<section class="page"><h1>강동현 · Infrastructure / Platform Engineer</h1><h2>장애를 직접 재현하고, 무엇이 끊기고 무엇이 남는지 숫자로 확인했습니다</h2><blockquote><p>K3s home lab에서 요청 경로와 상태가 남는 위치를 먼저 찾고, DB 지연·rolling restart·인증서 갱신·동시 refresh 같은 조건을 직접 만들어 관측했습니다. 아래 숫자는 모두 그 실험에서 측정한 값입니다.</p></blockquote><table class="metric-table"><tbody><tr><td><strong>66 → 1,872 ms</strong></td><td><strong>151 → 151</strong></td><td><strong>2,305 s → 1–2 s</strong></td></tr><tr><td>DB에 200 ms 지연을 넣었을 때 login 응답</td><td>rolling restart 전후 DB session row</td><td>인증서 갱신이 실제 serving에 반영되는 시간</td></tr></tbody></table><p>K3s · Nginx · Traefik · Keycloak · PostgreSQL · Redis · Vault · Prometheus · Grafana · Loki · Tempo</p><table class="two-col-table"><tbody><tr><td>GitHub</td><td><a href="https://github.com/donghyeon-ka">github.com/donghyeon-ka</a></td></tr><tr><td>TechLog</td><td><a href="https://hyeonworks.com">hyeonworks.com</a></td></tr><tr><td>Email</td><td>donghyeonka68@gmail.com</td></tr></tbody></table></section>
<section class="page"><h1>01 · Request Path</h1><h2>외부에서 cluster로 들어오는 문을 Host Nginx 하나로 줄였습니다</h2><p><strong>요청이 실제로 어느 순서로 들어오는가?</strong> · 개인 home lab / dev · Host Nginx · K3s · Traefik · CloudNativePG</p><p>TLS는 Host Nginx :443에서 끝나고, 그 뒤 hop은 모두 loopback 안에서만 일어납니다. Traefik NodePort를 <code>127.0.0.1</code>에만 bind해 LAN에서 NodePort로 직접 들어오는 경로를 없앴고, PostgreSQL Service에는 Ingress / NodePort / LoadBalancer를 두지 않았습니다.</p><figure><img src="file:///home/donghyeon/workspace/chat-gpt-container/Resume/assets/portfolio/platform-request-path-simple.svg" alt="WIDE"></figure><p>들어오는 문이 하나면 인증서, forwarded header, 차단 규칙을 한 곳에서만 맞추면 됩니다. 대신 그 한 곳이 단일 실패 지점이므로, 아래 Edge Trust에서 무엇까지 Host Nginx가 책임지는지 정리했습니다.</p><p><strong>Scope</strong> — 단일 물리 서버 home lab입니다. 1/1 Ready나 Local PV Retain을 HA나 backup으로 표현하지 않습니다.</p></section>
<section class="page"><h1>02 · Edge Trust</h1><h2>forwarded header를 믿기 전에 누가 만들 수 있는지부터 막았습니다</h2><p><strong>클라이언트가 보낸 값과 edge가 확정한 값을 어디서 구분하는가?</strong> · Host Nginx · Traefik</p><p>외부 요청이 보낸 <code>X-Forwarded-*</code>는 신뢰하지 않고 Host Nginx가 다시 만듭니다. Traefik은 그 Host Nginx만 trusted proxy로 인정하므로, 내부에서 보이는 hostname과 client IP는 edge가 확정한 값입니다.</p><figure><img src="file:///home/donghyeon/workspace/chat-gpt-container/Resume/assets/portfolio/edge-trust-simple.svg" alt="WIDE"></figure><ul><li>Host Nginx upstream: <code>127.0.0.1:30080</code></li><li>K3s NodePort bind: <code>127.0.0.0/8</code></li><li>Traefik trusted proxy: <code>10.42.0.1/32</code></li><li>관리 hostname: LAN <code>192.168.0.0/24</code> + Tailscale <code>100.64.0.0/10</code> allowlist</li><li>Gitea / Grafana / metrics의 외부 우회 경로는 404</li></ul></section>
<section class="page"><h1>03 · Keycloak · Session State</h1><h2>Persistent user session은 PostgreSQL에, cache는 각 replica에 남습니다</h2><p><strong>replica를 늘리면 세션은 정말 유지되는가?</strong> · VM 2대 · 2-node K3s · Keycloak 26 · JGroups</p><p><code>persistent-user-sessions</code>를 켜면 user session의 durable state는 PostgreSQL에 남고, 각 replica는 그와 별개로 local cache를 가집니다. JGroups는 node discovery와 cluster transport를 담당할 뿐 durable state를 소유하지 않습니다.</p><figure><img src="file:///home/donghyeon/workspace/chat-gpt-container/Resume/assets/portfolio/keycloak-session-ownership.svg" alt="CHART"></figure><p>replica가 2개라는 사실만으로 세션이 유지되는 것이 아니라, 유지되는 이유가 외부 PostgreSQL에 있습니다. 다음 페이지에서 실제로 replica를 재시작해 어느 쪽이 남는지 확인했습니다.</p></section>
<section class="page"><h1>04 · Keycloak · Rolling Restart</h1><h2>restart 중에도 DB session은 151 → 151로 그대로였습니다</h2><p><strong>재시작하면 무엇이 끊기고 무엇이 남는가?</strong> · rolling restart · 2-node K3s</p><p>재시작하는 동안 service 응답은 계속 HTTP 200이었고, PostgreSQL의 session row는 <strong>151 → 151</strong>로 유지됐습니다. 재시작한 replica의 local session cache만 0에서 다시 만들어졌고, 재시작 전에 발급한 refresh token도 이후 요청에서 HTTP 200을 받았습니다.</p><figure><img src="file:///home/donghyeon/workspace/chat-gpt-container/Resume/assets/portfolio/keycloak-restart-before-after.svg" alt="FULL"></figure><p><strong>Scope</strong> — 한 물리 서버 안의 2 VM lab 결과입니다. 물리 장애를 포함한 production HA 결과가 아닙니다.</p></section>
<section class="page"><h1>05 · Keycloak · Latency Fault</h1><h2>DB에 넣은 200 ms가 login 1,872 ms와 readiness 실패까지 커졌습니다</h2><p><strong>한 곳의 지연은 어디까지 번지는가?</strong> · PostgreSQL 앞단에 200 ms 지연 주입 · 동시 20건</p><p>200 ms는 login 한 번에 여러 번 일어나는 DB round trip마다 붙었고, 느려진 요청이 connection을 오래 쥐면서 뒤 요청의 pool wait까지 끌어올렸습니다. 마지막에는 readiness probe가 timeout되어 느린 Pod가 load-balancing 대상에서 빠졌습니다.</p><figure><img src="file:///home/donghyeon/workspace/chat-gpt-container/Resume/assets/portfolio/keycloak-latency-cascade.svg" alt="TOPOLOGY"></figure><p>주입한 지연 자체보다, 그 지연이 connection pool과 readiness를 거치며 한 자릿수 배가 아니라 20배 이상으로 커진 점이 이 실험의 결과입니다.</p></section>
<section class="page"><h1>06 · Keycloak · Refresh Rotation</h1><h2>같은 refresh token을 동시에 쓰자 client session이 끊겼습니다</h2><p><strong>rotation 중에 요청이 겹치면 어느 쪽이 실패하는가?</strong> · <code>revokeRefreshToken=true</code> · <code>refreshTokenMaxReuse=0</code> · 동일 token 5건 동시 요청</p><p>같은 refresh token으로 5건을 동시에 보냈습니다. 재사용이 감지된 뒤 client session이 무효화됐고, 그중 먼저 성공 응답으로 받아 둔 <strong>새 refresh token도 이후에는 쓸 수 없었습니다.</strong></p><figure><img src="file:///home/donghyeon/workspace/chat-gpt-container/Resume/assets/portfolio/refresh-rotation-horizontal.svg" alt="WIDE"></figure><p>순차로 보냈을 때는 같은 현상이 나오지 않았습니다. 클라이언트 입장에서는 &quot;refresh 한 번 실패&quot;와 &quot;세션 자체가 끊김&quot;이 다른 상황이므로, error handling에서 이 둘을 구분해 재로그인으로 넘길지 판단해야 합니다.</p></section>
<section class="page"><h1>07 · Keycloak · JWKS Cache</h1><h2>같은 token이 replica에 따라 200과 401로 갈렸습니다</h2><p><strong>서명 키를 지우면 각 replica는 언제 그것을 아는가?</strong> · Resource Server 2 replica · Nimbus JWKS cache</p><p>realm에서 old signing key를 지운 직후 같은 old access token으로 반복 요청했더니 응답이 <strong>401 → 200 → 401 → 200 → 401 → 200 → 401 → 200</strong>으로 번갈아 나왔습니다.</p><figure><img src="file:///home/donghyeon/workspace/chat-gpt-container/Resume/assets/portfolio/jwks-cache-replicas.svg" alt="TOPOLOGY"></figure><p>검증은 Keycloak이 매 요청마다 해 주는 것이 아니라 각 Resource Server replica가 자기 JWKS cache로 합니다. 두 replica의 cache 갱신 시점이 달라서, 한쪽은 아직 old key를 들고 200을, 다른 쪽은 새 JWKS를 반영해 401을 반환했습니다. key를 지운 시점만으로는 이 교차를 설명할 수 없었고, replica별 cache 갱신 시점까지 봐야 설명됐습니다.</p></section>
<section class="page"><h1>08 · TLS Renewal</h1><h2>인증서 파일이 갱신된 뒤 실제 serving까지 38분 25초가 비어 있었습니다</h2><p><strong>갱신은 성공했는데 왜 옛 인증서가 나가는가?</strong> · certbot timer · Host Nginx</p><p>certbot timer는 성공하고 있었지만 deploy hook이 없었습니다. 새 certificate 파일이 생긴 시점과 Nginx worker가 그 파일을 다시 읽는 시점이 분리돼 있어서, 그 사이에는 갱신 전 인증서가 계속 나갔습니다.</p><figure><img src="file:///home/donghyeon/workspace/chat-gpt-container/Resume/assets/portfolio/tls-renewal-before-after.svg" alt="CHART"></figure><ul><li>renewal → serving gap: <strong>2,305 s → 1–2 s</strong> (deploy hook 적용 후)</li><li>별도의 manual reload 부하 실험: <strong>8,856 / 8,856 HTTP 200</strong>, p95 <strong>205.7 ms → 204.3 ms</strong></li><li>reload 중이던 845 KB 응답도 <strong>845,361 bytes 전부 수신</strong></li></ul></section>
<section class="page"><h1>09 · Vault · Secret Delivery</h1><h2>workload는 Vault token 없이 Kubernetes Secret만 소비합니다</h2><p><strong>누가 인증되고 누가 secret을 읽는가?</strong> · Vault 1.17.2 · Vault Secrets Operator · Kubernetes Auth · KV-v2</p><p>secret의 source of truth는 Vault KV-v2에 두되, Vault와 직접 이야기하는 주체는 Vault Secrets Operator 하나로 제한했습니다. VSO가 자기 ServiceAccount token으로 Kubernetes Auth를 통과하면, policy와 role이 읽을 수 있는 path를 정하고, 그 결과만 Kubernetes Secret으로 동기화됩니다.</p><figure><img src="file:///home/donghyeon/workspace/chat-gpt-container/Resume/assets/portfolio/vault-secret-delivery.svg" alt="CHART"></figure><p>workload는 Vault API도 Vault token도 다루지 않습니다. secret을 바꿀 때 rotation이 무중단으로 반영되는지는 따로 측정하지 않았으므로 여기서는 전달 경로까지만 이야기합니다.</p><p><strong>Scope</strong> — Vault 1 replica · file storage · local-path PVC · manual init/unseal. 3-node Raft, auto-unseal, full Vault TLS 구성으로 확대하지 않습니다.</p></section>
<section class="page"><h1>10 · Observability</h1><h2>metric · log · trace · alert는 보내는 방식부터 다릅니다</h2><p><strong>어떤 신호가 어디에 저장되고, 무엇으로 이어 보는가?</strong> · Prometheus · Loki · Tempo · Alertmanager</p><p>네 신호를 한 덩어리로 다루면 &quot;어디를 봐야 하는가&quot;에 답할 수 없습니다. 수집 방식부터 다릅니다. Prometheus는 target을 직접 scrape하고(pull), log와 trace는 소스가 Alloy로 보냅니다(push).</p><figure><img src="file:///home/donghyeon/workspace/chat-gpt-container/Resume/assets/portfolio/observability-paths-large.svg" alt="CHART"></figure><p>Grafana는 세 저장소를 같이 조회하는 지점이지 저장소가 아니고, alert는 Prometheus rule에서 갈라져 Slack으로 나갑니다. 한 요청을 metric·log·trace에서 이어 보려면 저장소가 아니라 request id 같은 공통 key를 각 신호에 같이 실어야 합니다.</p></section>
</main>
</body>
</html>