@xdev-asia/xdev-knowledge-mcp 1.0.43 → 1.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/content/pages/xoa-du-lieu-nguoi-dung.md +68 -0
  2. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/01-phan-1-data-engineering/lessons/01-bai-1-data-repositories-ingestion.md +5 -0
  3. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/01-phan-1-data-engineering/lessons/02-bai-2-data-transformation.md +5 -0
  4. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/01-phan-1-data-engineering/lessons/03-bai-3-data-analysis.md +159 -0
  5. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/02-phan-2-modeling/lessons/04-bai-4-sagemaker-built-in-algorithms.md +186 -0
  6. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/02-phan-2-modeling/lessons/05-bai-5-training-hyperparameter-tuning.md +159 -0
  7. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/02-phan-2-modeling/lessons/06-bai-6-model-evaluation.md +169 -0
  8. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/03-phan-3-implementation-operations/lessons/07-bai-7-model-deployment.md +193 -0
  9. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/03-phan-3-implementation-operations/lessons/08-bai-8-model-monitoring-mlops.md +184 -0
  10. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/03-phan-3-implementation-operations/lessons/09-bai-9-security-cost.md +166 -0
  11. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/04-phan-4-on-tap/lessons/10-bai-10-bai-toan-thuong-gap.md +181 -0
  12. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/04-phan-4-on-tap/lessons/11-bai-11-cheat-sheet.md +110 -0
  13. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/04-phan-4-on-tap/lessons/12-bai-12-chien-luoc-thi.md +113 -0
  14. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/index.md +1 -1
  15. package/content/series/luyen-thi/luyen-thi-cka/chapters/01-cluster-architecture/lessons/01-kien-truc-cka-kubeadm.md +133 -0
  16. package/content/series/luyen-thi/luyen-thi-cka/chapters/01-cluster-architecture/lessons/02-cluster-upgrade-kubeadm.md +147 -0
  17. package/content/series/luyen-thi/luyen-thi-cka/chapters/01-cluster-architecture/lessons/03-rbac-cka.md +152 -0
  18. package/content/series/luyen-thi/luyen-thi-cka/chapters/02-workloads-scheduling/lessons/04-deployments-daemonsets-statefulsets.md +186 -0
  19. package/content/series/luyen-thi/luyen-thi-cka/chapters/02-workloads-scheduling/lessons/05-scheduling-taints-affinity.md +163 -0
  20. package/content/series/luyen-thi/luyen-thi-cka/chapters/03-services-networking/lessons/06-services-endpoints-coredns.md +145 -0
  21. package/content/series/luyen-thi/luyen-thi-cka/chapters/03-services-networking/lessons/07-ingress-networkpolicies-cni.md +172 -0
  22. package/content/series/luyen-thi/luyen-thi-cka/chapters/04-storage/lessons/08-persistent-volumes-storageclass.md +159 -0
  23. package/content/series/luyen-thi/luyen-thi-cka/chapters/05-troubleshooting/lessons/09-etcd-backup-restore.md +149 -0
  24. package/content/series/luyen-thi/luyen-thi-cka/chapters/05-troubleshooting/lessons/10-troubleshooting-nodes.md +153 -0
  25. package/content/series/luyen-thi/luyen-thi-cka/chapters/05-troubleshooting/lessons/11-troubleshooting-workloads.md +146 -0
  26. package/content/series/luyen-thi/luyen-thi-cka/chapters/05-troubleshooting/lessons/12-troubleshooting-networking-exam.md +170 -0
  27. package/content/series/luyen-thi/luyen-thi-cka/index.md +217 -0
  28. package/content/series/luyen-thi/luyen-thi-ckad/chapters/01-app-design-build/lessons/01-multi-container-pods.md +146 -0
  29. package/content/series/luyen-thi/luyen-thi-ckad/chapters/01-app-design-build/lessons/02-jobs-cronjobs-resources.md +174 -0
  30. package/content/series/luyen-thi/luyen-thi-ckad/chapters/02-app-deployment/lessons/03-rolling-updates-rollbacks.md +148 -0
  31. package/content/series/luyen-thi/luyen-thi-ckad/chapters/02-app-deployment/lessons/04-helm-kustomize.md +181 -0
  32. package/content/series/luyen-thi/luyen-thi-ckad/chapters/03-app-observability/lessons/05-probes-logging-debugging.md +183 -0
  33. package/content/series/luyen-thi/luyen-thi-ckad/chapters/04-app-environment-config/lessons/06-configmaps-secrets.md +182 -0
  34. package/content/series/luyen-thi/luyen-thi-ckad/chapters/04-app-environment-config/lessons/07-securitycontext-pod-security.md +168 -0
  35. package/content/series/luyen-thi/luyen-thi-ckad/chapters/04-app-environment-config/lessons/08-resources-qos.md +168 -0
  36. package/content/series/luyen-thi/luyen-thi-ckad/chapters/05-services-networking/lessons/09-services-ingress.md +182 -0
  37. package/content/series/luyen-thi/luyen-thi-ckad/chapters/05-services-networking/lessons/10-networkpolicies-exam-strategy.md +236 -0
  38. package/content/series/luyen-thi/luyen-thi-ckad/index.md +199 -0
  39. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/01-phan-1-problem-framing/lessons/01-bai-1-framing-ml-problems.md +136 -0
  40. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/01-phan-1-problem-framing/lessons/02-bai-2-gcp-ai-ml-ecosystem.md +160 -0
  41. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/02-phan-2-data-engineering/lessons/03-bai-3-data-pipeline.md +174 -0
  42. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/02-phan-2-data-engineering/lessons/04-bai-4-feature-engineering.md +156 -0
  43. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/03-phan-3-model-development/lessons/05-bai-5-vertex-ai-training.md +155 -0
  44. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/03-phan-3-model-development/lessons/06-bai-6-bigquery-ml-tensorflow.md +141 -0
  45. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/04-phan-4-deployment-mlops/lessons/07-bai-7-model-deployment.md +134 -0
  46. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/04-phan-4-deployment-mlops/lessons/08-bai-8-vertex-ai-pipelines-mlops.md +149 -0
  47. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/05-phan-5-responsible-ai/lessons/09-bai-9-responsible-ai.md +128 -0
  48. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/05-phan-5-responsible-ai/lessons/10-bai-10-cheat-sheet-chien-luoc-thi.md +108 -0
  49. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/index.md +1 -1
  50. package/content/series/luyen-thi/luyen-thi-kcna/chapters/01-kubernetes-fundamentals/lessons/01-kien-truc-kubernetes.md +137 -0
  51. package/content/series/luyen-thi/luyen-thi-kcna/chapters/01-kubernetes-fundamentals/lessons/02-pods-workloads-controllers.md +142 -0
  52. package/content/series/luyen-thi/luyen-thi-kcna/chapters/01-kubernetes-fundamentals/lessons/03-services-networking-storage.md +155 -0
  53. package/content/series/luyen-thi/luyen-thi-kcna/chapters/01-kubernetes-fundamentals/lessons/04-rbac-security.md +137 -0
  54. package/content/series/luyen-thi/luyen-thi-kcna/chapters/02-container-orchestration/lessons/05-container-runtimes-oci.md +137 -0
  55. package/content/series/luyen-thi/luyen-thi-kcna/chapters/02-container-orchestration/lessons/06-orchestration-patterns.md +147 -0
  56. package/content/series/luyen-thi/luyen-thi-kcna/chapters/03-cloud-native-architecture/lessons/07-cloud-native-architecture.md +143 -0
  57. package/content/series/luyen-thi/luyen-thi-kcna/chapters/04-observability-delivery/lessons/08-observability.md +143 -0
  58. package/content/series/luyen-thi/luyen-thi-kcna/chapters/04-observability-delivery/lessons/09-helm-gitops-cicd.md +162 -0
  59. package/content/series/luyen-thi/luyen-thi-kcna/index.md +168 -0
  60. package/data/quizzes.json +1059 -0
  61. package/package.json +1 -1
@@ -0,0 +1,182 @@
1
+ ---
2
+ id: ckad-d5-l09
3
+ title: 'Bài 9: Services & Ingress'
4
+ slug: 09-services-ingress
5
+ description: >-
6
+ Service types: ClusterIP, NodePort, LoadBalancer, ExternalName. kubectl expose.
7
+ Ingress resources, IngressClass, TLS termination và path-based routing.
8
+ duration_minutes: 60
9
+ is_free: true
10
+ video_url: null
11
+ sort_order: 9
12
+ section_title: "Domain 5: Services and Networking (20%)"
13
+ course:
14
+ id: lt-ckad-series-001
15
+ title: 'Luyện thi CKAD — Certified Kubernetes Application Developer'
16
+ slug: luyen-thi-ckad
17
+ ---
18
+
19
+ <img src="/storage/uploads/2026/04/k8s-cert-ckad-bai9-services-ingress.png" alt="Service Types và Ingress Routing — ClusterIP, NodePort, LoadBalancer" style="max-width: 800px; width: 100%; border-radius: 12px;" />
20
+
21
+ <h2 id="service-types">1. Service Types</h2>
22
+
23
+ <table>
24
+ <thead><tr><th>Type</th><th>Access</th><th>Dùng khi nào</th></tr></thead>
25
+ <tbody>
26
+ <tr><td><strong>ClusterIP</strong></td><td>Internal only (cluster DNS)</td><td>Service-to-service communication (default)</td></tr>
27
+ <tr><td><strong>NodePort</strong></td><td>NodeIP:30000-32767</td><td>Dev/test external access</td></tr>
28
+ <tr><td><strong>LoadBalancer</strong></td><td>Cloud LB external IP</td><td>Production external access (cloud)</td></tr>
29
+ <tr><td><strong>ExternalName</strong></td><td>CNAME DNS alias</td><td>Route to external DNS name</td></tr>
30
+ </tbody>
31
+ </table>
32
+
33
+ <pre><code class="language-text">ClusterIP (default):
34
+ apiVersion: v1
35
+ kind: Service
36
+ metadata:
37
+ name: myapp-svc
38
+ spec:
39
+ type: ClusterIP # Can omit — default
40
+ selector:
41
+ app: myapp
42
+ ports:
43
+ - port: 80 # Service port (what clients connect to)
44
+ targetPort: 8080 # Container port (where app listens)
45
+
46
+ NodePort:
47
+ spec:
48
+ type: NodePort
49
+ ports:
50
+ - port: 80
51
+ targetPort: 8080
52
+ nodePort: 30080 # Optional: 30000-32767 range (auto-assigned if omitted)</code></pre>
53
+
54
+ <h2 id="kubectl-expose">2. kubectl expose</h2>
55
+
56
+ <pre><code class="language-text"># Expose Deployment as ClusterIP (default)
57
+ kubectl expose deployment myapp --port=80 --target-port=8080
58
+
59
+ # Expose as NodePort
60
+ kubectl expose deployment myapp --port=80 --target-port=8080 --type=NodePort
61
+
62
+ # Expose a Pod
63
+ kubectl expose pod mypod --port=80 --name=mypod-svc
64
+
65
+ # Expose existing service quickly and redirect traffic
66
+ kubectl run nginx --image=nginx --port=80 --expose
67
+ # This creates both the Pod AND the ClusterIP Service</code></pre>
68
+
69
+ <blockquote><p><strong>Exam tip:</strong> <code>kubectl expose</code> cần selector match với Pod labels. Nếu Deployment đang dùng <code>app: myapp</code>, Service selector phải là <code>app: myapp</code>. Flag <code>--expose</code> khi dùng với <code>kubectl run</code> tạo cả Pod lẫn Service cùng lúc — rất nhanh trong exam.</p></blockquote>
70
+
71
+ <h2 id="ingress">3. Ingress</h2>
72
+
73
+ <p>Ingress là L7 HTTP/HTTPS routing — một điểm vào, route đến nhiều Services dựa trên host/path.</p>
74
+
75
+ <pre><code class="language-text"> ┌─────────────────────────────────┐
76
+ Internet ──────────►│ Ingress Controller (nginx) │
77
+ │ │
78
+ │ /api ──────────► api-service │
79
+ │ /web ──────────► web-service │
80
+ │ blog.example.com → blog-service │
81
+ └─────────────────────────────────┘</code></pre>
82
+
83
+ <pre><code class="language-text">apiVersion: networking.k8s.io/v1
84
+ kind: Ingress
85
+ metadata:
86
+ name: myapp-ingress
87
+ annotations:
88
+ nginx.ingress.kubernetes.io/rewrite-target: /
89
+ spec:
90
+ ingressClassName: nginx # Which IngressClass to use
91
+ tls:
92
+ - hosts:
93
+ - myapp.example.com
94
+ secretName: myapp-tls # TLS cert stored as Secret
95
+ rules:
96
+ - host: myapp.example.com
97
+ http:
98
+ paths:
99
+ - path: /api
100
+ pathType: Prefix # Prefix or Exact
101
+ backend:
102
+ service:
103
+ name: api-service
104
+ port:
105
+ number: 80
106
+ - path: /web
107
+ pathType: Prefix
108
+ backend:
109
+ service:
110
+ name: web-service
111
+ port:
112
+ number: 80</code></pre>
113
+
114
+ <table>
115
+ <thead><tr><th>pathType</th><th>Hành vi</th><th>Ví dụ</th></tr></thead>
116
+ <tbody>
117
+ <tr><td><strong>Exact</strong></td><td>Match chính xác path</td><td><code>/api</code> chỉ match <code>/api</code></td></tr>
118
+ <tr><td><strong>Prefix</strong></td><td>Match path prefix</td><td><code>/api</code> match <code>/api</code>, <code>/api/v1</code>, <code>/api/users</code></td></tr>
119
+ <tr><td><strong>ImplementationSpecific</strong></td><td>Tùy IngressClass</td><td>Depends on controller</td></tr>
120
+ </tbody>
121
+ </table>
122
+
123
+ <blockquote><p><strong>Exam tip:</strong> Ingress cần <strong>Ingress Controller</strong> (như nginx, traefik) mới hoạt động — Ingress resource chỉ là config. IngressClass chỉ định controller nào xử lý. Trong exam, IngressClass thường đã được setup sẵn. Nhớ check <code>kubectl get ingressclass</code> để biết tên.</p></blockquote>
124
+
125
+ <h2 id="debug-service">4. Debug Service Connectivity</h2>
126
+
127
+ <pre><code class="language-text"># Check service exists và endpoints
128
+ kubectl get services
129
+ kubectl get endpoints myapp-svc
130
+
131
+ # Test connectivity từ trong cluster (create temp pod)
132
+ kubectl run test --image=busybox --rm -it -- wget -qO- http://myapp-svc
133
+ kubectl run test --image=curlimages/curl --rm -it -- curl http://myapp-svc:80
134
+
135
+ # Check if selector matches pods
136
+ kubectl get pods -l app=myapp # Should match service selector
137
+ kubectl describe service myapp-svc # Shows Endpoints section
138
+
139
+ # If Endpoints is empty: selector mismatch!
140
+ # Check: kubectl get pods --show-labels</code></pre>
141
+
142
+ <h2 id="cheatsheet">5. Cheat Sheet</h2>
143
+
144
+ <table>
145
+ <thead><tr><th>Task</th><th>Command</th></tr></thead>
146
+ <tbody>
147
+ <tr><td>Expose Deployment</td><td><code>kubectl expose deploy/app --port=80 --type=NodePort</code></td></tr>
148
+ <tr><td>Create Pod + Service</td><td><code>kubectl run nginx --image=nginx --port=80 --expose</code></td></tr>
149
+ <tr><td>Check service endpoints</td><td><code>kubectl get endpoints svc-name</code></td></tr>
150
+ <tr><td>Test service từ trong cluster</td><td><code>kubectl run tmp --image=busybox --rm -it -- wget -O- http://svc</code></td></tr>
151
+ <tr><td>Ingress với TLS</td><td>tls: secretName + hosts trong rules</td></tr>
152
+ </tbody>
153
+ </table>
154
+
155
+ <h2 id="practice">6. Practice Questions</h2>
156
+
157
+ <p><strong>Q1:</strong> A Deployment named "webapp" with selector app=webapp runs on port 8080. You need to create a Service that makes it accessible within the cluster on port 80. Which command creates this correctly?</p>
158
+ <ul>
159
+ <li>A) <code>kubectl expose deployment webapp --port=8080</code></li>
160
+ <li>B) <code>kubectl expose deployment webapp --port=80 --target-port=8080</code> ✓</li>
161
+ <li>C) <code>kubectl create service clusterip webapp --port=8080:80</code></li>
162
+ <li>D) <code>kubectl expose deployment webapp --type=ClusterIP --port=80</code></li>
163
+ </ul>
164
+ <p><em>Explanation: --port=80 is the Service port (what clients use), --target-port=8080 is the container port (where the app listens). Without --target-port, Kubernetes assumes target-port equals port. Option D would work but uses same port 80 for both.</em></p>
165
+
166
+ <p><strong>Q2:</strong> An Ingress resource exists but traffic doesn't reach the backend Services. kubectl get endpoints shows the correct Pod IPs. What is the most likely cause?</p>
167
+ <ul>
168
+ <li>A) The Service type should be LoadBalancer instead of ClusterIP</li>
169
+ <li>B) No Ingress Controller is installed or the ingressClassName is wrong ✓</li>
170
+ <li>C) The Ingress needs TLS configured</li>
171
+ <li>D) The pathType should be Exact instead of Prefix</li>
172
+ </ul>
173
+ <p><em>Explanation: Ingress resources are just configuration objects. Without an Ingress Controller, nothing processes the rules. If the ingressClassName doesn't match an IngressClass connected to a running controller, the Ingress is effectively ignored. Always verify kubectl get ingressclass and that the controller Pod is running.</em></p>
174
+
175
+ <p><strong>Q3:</strong> Which Service type provides external access using a port in the range 30000-32767 on every cluster node?</p>
176
+ <ul>
177
+ <li>A) ClusterIP</li>
178
+ <li>B) ExternalName</li>
179
+ <li>C) NodePort ✓</li>
180
+ <li>D) LoadBalancer</li>
181
+ </ul>
182
+ <p><em>Explanation: NodePort opens a port in the 30000-32767 range on every Node in the cluster. External traffic can reach the Service via NodeIP:NodePort. This is typically used for development and testing. LoadBalancer provides a cloud load balancer with a stable external IP, which is preferred for production.</em></p>
@@ -0,0 +1,236 @@
1
+ ---
2
+ id: ckad-d5-l10
3
+ title: 'Bài 10: NetworkPolicies & CKAD Exam Strategy'
4
+ slug: 10-networkpolicies-exam-strategy
5
+ description: >-
6
+ NetworkPolicy ingress/egress rules, default-deny patterns và pod selector.
7
+ CKAD exam strategy: kubectl shortcuts, --dry-run pattern và time management.
8
+ duration_minutes: 60
9
+ is_free: true
10
+ video_url: null
11
+ sort_order: 10
12
+ section_title: "Domain 5: Services and Networking (20%)"
13
+ course:
14
+ id: lt-ckad-series-001
15
+ title: 'Luyện thi CKAD — Certified Kubernetes Application Developer'
16
+ slug: luyen-thi-ckad
17
+ ---
18
+
19
+ <img src="/storage/uploads/2026/04/k8s-cert-ckad-bai10-networkpolicy.png" alt="NetworkPolicy — ingress/egress rules, default-deny và AND/OR logic" style="max-width: 800px; width: 100%; border-radius: 12px;" />
20
+
21
+ <h2 id="networkpolicy">1. NetworkPolicy</h2>
22
+
23
+ <p>Mặc định, tất cả Pods trong cluster có thể communicate với nhau. NetworkPolicy giới hạn traffic dựa trên labels.</p>
24
+
25
+ <pre><code class="language-text">Default: All pods can talk to all pods (no restriction)
26
+
27
+ After applying default-deny-all:
28
+ Pod A ──✗──► Pod B (blocked)
29
+ Pod A ──✗──► Pod C (blocked)
30
+
31
+ After applying allow policy:
32
+ Pod A (app=frontend) ──✓──► Pod B (app=backend, port 3000)
33
+ Pod A ──✗──► Pod C (app=database) (still blocked)</code></pre>
34
+
35
+ <h2 id="policy-syntax">2. NetworkPolicy Syntax</h2>
36
+
37
+ <pre><code class="language-text">apiVersion: networking.k8s.io/v1
38
+ kind: NetworkPolicy
39
+ metadata:
40
+ name: backend-policy
41
+ namespace: production
42
+ spec:
43
+ podSelector: # Applies to these pods (empty = all pods in ns)
44
+ matchLabels:
45
+ app: backend
46
+ policyTypes:
47
+ - Ingress # Controls inbound traffic
48
+ - Egress # Controls outbound traffic
49
+ ingress:
50
+ - from:
51
+ - podSelector: # Allow from pods with this label
52
+ matchLabels:
53
+ app: frontend
54
+ - namespaceSelector: # Allow from pods in these namespaces
55
+ matchLabels:
56
+ name: production
57
+ ports:
58
+ - protocol: TCP
59
+ port: 3000
60
+ egress:
61
+ - to:
62
+ - podSelector:
63
+ matchLabels:
64
+ app: database
65
+ ports:
66
+ - protocol: TCP
67
+ port: 5432</code></pre>
68
+
69
+ <blockquote><p><strong>Exam tip — AND vs OR trong NetworkPolicy:</strong><br/>
70
+ <code>from: [{podSelector}, {namespaceSelector}]</code> = OR (pod from either selector)<br/>
71
+ <code>from: [{podSelector + namespaceSelector}]</code> in SAME item = AND (pod matching both)<br/>
72
+ Đây là một trong những câu hỏi trap nhất của CKAD.</p></blockquote>
73
+
74
+ <h2 id="common-patterns">3. Common Patterns</h2>
75
+
76
+ <pre><code class="language-text">Pattern 1: Default deny all ingress
77
+ ---
78
+ apiVersion: networking.k8s.io/v1
79
+ kind: NetworkPolicy
80
+ metadata:
81
+ name: default-deny-ingress
82
+ spec:
83
+ podSelector: {} # Empty = match ALL pods
84
+ policyTypes:
85
+ - Ingress
86
+ # No ingress rules = deny all ingress
87
+
88
+ Pattern 2: Default deny all (both ingress + egress)
89
+ ---
90
+ spec:
91
+ podSelector: {}
92
+ policyTypes:
93
+ - Ingress
94
+ - Egress
95
+ # No rules = deny all
96
+
97
+ Pattern 3: Allow all ingress (override deny)
98
+ ---
99
+ spec:
100
+ podSelector: {}
101
+ policyTypes:
102
+ - Ingress
103
+ ingress:
104
+ - {} # Empty rule = allow all ingress</code></pre>
105
+
106
+ <table>
107
+ <thead><tr><th>Pattern</th><th>policyTypes</th><th>Rules</th><th>Effect</th></tr></thead>
108
+ <tbody>
109
+ <tr><td>Deny all ingress</td><td>[Ingress]</td><td>Không có ingress rules</td><td>Block all inbound</td></tr>
110
+ <tr><td>Deny all egress</td><td>[Egress]</td><td>Không có egress rules</td><td>Block all outbound</td></tr>
111
+ <tr><td>Allow specific</td><td>[Ingress]</td><td>ingress rules listed</td><td>Allow matching only</td></tr>
112
+ <tr><td>Allow DNS egress</td><td>[Egress]</td><td>to port 53 (UDP+TCP)</td><td>Allow DNS queries</td></tr>
113
+ </tbody>
114
+ </table>
115
+
116
+ <blockquote><p><strong>Exam tip:</strong> NetworkPolicy chỉ hoạt động nếu CNI plugin hỗ trợ (Calico, Cilium, Weave). <strong>Flannel không hỗ trợ NetworkPolicy!</strong> Ingress/Egress rules là additive — nếu nhiều policies apply đến cùng Pod, Kubernetes OR tất cả rules lại.</p></blockquote>
117
+
118
+ <h2 id="exam-strategy">4. CKAD Exam Strategy</h2>
119
+
120
+ <pre><code class="language-text">Thông tin exam:
121
+ - 2 giờ, ~15-20 tasks thực hành (performance-based)
122
+ - Mỗi task có value % khác nhau (ưu tiên task cao điểm trước)
123
+ - Pass score: 66%
124
+ - Được dùng docs: kubernetes.io/docs + helm.sh/docs
125
+
126
+ Keyboard shortcuts quan trọng:
127
+ k = kubectl (export alias k=kubectl trong exam, đã set sẵn)
128
+ CTRL+R = search command history
129
+ CTRL+A = go to beginning of line</code></pre>
130
+
131
+ <pre><code class="language-text">Workflow cho mỗi task:
132
+
133
+ 1. ĐỌC KỸ task description (đặc biệt để ý namespace!)
134
+ 2. Switch context nếu cần:
135
+ kubectl config use-context cluster-name
136
+ 3. Set namespace shortcut:
137
+ export ns=target-namespace
138
+ alias kn="kubectl -n $ns"
139
+ 4. Dùng --dry-run=client -o yaml để generate YAML:
140
+ kubectl run pod --image=nginx --dry-run=client -o yaml > pod.yaml
141
+ 5. Edit YAML, apply, verify:
142
+ kubectl apply -f pod.yaml
143
+ kubectl get pods -n $ns</code></pre>
144
+
145
+ <h2 id="dry-run-pattern">5. --dry-run Pattern</h2>
146
+
147
+ <pre><code class="language-text"># Generate YAML templates nhanh hơn viết tay:
148
+
149
+ Pod:
150
+ kubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml
151
+
152
+ Deployment:
153
+ kubectl create deployment myapp --image=nginx --replicas=3 \
154
+ --dry-run=client -o yaml > deploy.yaml
155
+
156
+ Service (ClusterIP):
157
+ kubectl create service clusterip myapp --tcp=80:8080 \
158
+ --dry-run=client -o yaml > svc.yaml
159
+
160
+ ConfigMap:
161
+ kubectl create configmap myconfig --from-literal=k=v \
162
+ --dry-run=client -o yaml > cm.yaml
163
+
164
+ Secret:
165
+ kubectl create secret generic mysecret --from-literal=pass=secret \
166
+ --dry-run=client -o yaml > secret.yaml
167
+
168
+ Job:
169
+ kubectl create job myjob --image=busybox -- echo hello \
170
+ --dry-run=client -o yaml > job.yaml
171
+
172
+ CronJob:
173
+ kubectl create cronjob mycron --image=busybox --schedule="*/1 * * * *" \
174
+ -- echo hello --dry-run=client -o yaml > cron.yaml</code></pre>
175
+
176
+ <h2 id="kubectl-shortcuts">6. Essential kubectl Shortcuts</h2>
177
+
178
+ <table>
179
+ <thead><tr><th>Lệnh đầy đủ</th><th>Short form</th></tr></thead>
180
+ <tbody>
181
+ <tr><td><code>kubectl get pods</code></td><td><code>k get po</code></td></tr>
182
+ <tr><td><code>kubectl get deployments</code></td><td><code>k get deploy</code></td></tr>
183
+ <tr><td><code>kubectl get services</code></td><td><code>k get svc</code></td></tr>
184
+ <tr><td><code>kubectl get namespaces</code></td><td><code>k get ns</code></td></tr>
185
+ <tr><td><code>kubectl get persistentvolumeclaims</code></td><td><code>k get pvc</code></td></tr>
186
+ <tr><td><code>kubectl get configmaps</code></td><td><code>k get cm</code></td></tr>
187
+ <tr><td><code>kubectl get serviceaccounts</code></td><td><code>k get sa</code></td></tr>
188
+ <tr><td><code>kubectl get networkpolicies</code></td><td><code>k get netpol</code></td></tr>
189
+ <tr><td><code>kubectl describe pod mypod</code></td><td><code>k describe po mypod</code></td></tr>
190
+ <tr><td><code>kubectl delete pod mypod --force</code></td><td><code>k delete po mypod --force</code></td></tr>
191
+ </tbody>
192
+ </table>
193
+
194
+ <h2 id="cheatsheet">7. Final CKAD Cheat Sheet</h2>
195
+
196
+ <table>
197
+ <thead><tr><th>Domain</th><th>Key Topics</th><th>% Weight</th></tr></thead>
198
+ <tbody>
199
+ <tr><td>App Design & Build</td><td>Multi-container, Init Containers, Jobs, CronJobs, volumes</td><td>20%</td></tr>
200
+ <tr><td>App Deployment</td><td>Rolling updates, rollbacks, Helm, Kustomize</td><td>20%</td></tr>
201
+ <tr><td>App Observability</td><td>Probes (liveness/readiness/startup), logs, debug</td><td>15%</td></tr>
202
+ <tr><td>App Env/Config/Security</td><td>ConfigMaps, Secrets, SecurityContext, SA, Resources, QoS</td><td>25%</td></tr>
203
+ <tr><td>Services & Networking</td><td>Services, Ingress, NetworkPolicies</td><td>20%</td></tr>
204
+ </tbody>
205
+ </table>
206
+
207
+ <h2 id="practice">8. Practice Questions</h2>
208
+
209
+ <p><strong>Q1:</strong> You apply a NetworkPolicy with podSelector: {} and policyTypes: [Ingress] but no ingress rules. What happens?</p>
210
+ <ul>
211
+ <li>A) All ingress traffic is allowed (no rules = no restriction)</li>
212
+ <li>B) All ingress traffic to ALL pods in the namespace is denied ✓</li>
213
+ <li>C) All pods are deleted</li>
214
+ <li>D) Only external ingress is denied; internal pod-to-pod traffic is allowed</li>
215
+ </ul>
216
+ <p><em>Explanation: podSelector: {} matches ALL pods in the namespace. policyTypes: [Ingress] says this policy controls ingress. Having no ingress rules means zero traffic is allowed. This is the "default deny all ingress" pattern. Pod-to-pod traffic within the cluster is also denied because NetworkPolicy controls all ingress, regardless of source.</em></p>
217
+
218
+ <p><strong>Q2:</strong> In a NetworkPolicy, what is the difference between these two from clauses?<br/>
219
+ Clause A: from: [{podSelector: {app: web}}, {namespaceSelector: {env: prod}}]<br/>
220
+ Clause B: from: [{podSelector: {app: web}, namespaceSelector: {env: prod}}]</p>
221
+ <ul>
222
+ <li>A) They are identical</li>
223
+ <li>B) Clause A: allow from pods with app=web OR from any pod in env=prod namespace. Clause B: allow only from pods with app=web AND in env=prod namespace ✓</li>
224
+ <li>C) Clause A uses AND logic, Clause B uses OR logic</li>
225
+ <li>D) Clause B is invalid YAML syntax</li>
226
+ </ul>
227
+ <p><em>Explanation: In NetworkPolicy, when podSelector and namespaceSelector are in SEPARATE list items (separated by -), they use OR logic. When they are in the SAME list item (same indentation level, no -), they use AND logic. This is a critical distinction and a common exam trap.</em></p>
228
+
229
+ <p><strong>Q3:</strong> During the CKAD exam, you need to create a Deployment with a specific Pod spec. What is the fastest approach?</p>
230
+ <ul>
231
+ <li>A) Write the entire YAML from memory</li>
232
+ <li>B) Search kubernetes.io docs and copy-paste example YAML</li>
233
+ <li>C) Use kubectl create deployment --dry-run=client -o yaml to generate a template, then edit ✓</li>
234
+ <li>D) Use helm to deploy a chart with default values</li>
235
+ </ul>
236
+ <p><em>Explanation: The --dry-run=client -o yaml pattern generates valid YAML without creating resources. You redirect to a file, edit only the fields that differ, then apply. This is faster than manual YAML authoring and less likely to have syntax errors. Combining with > file.yaml lets you make precise edits.</em></p>
@@ -0,0 +1,199 @@
1
+ ---
2
+ id: lt-ckad-series-001
3
+ title: "Luyện thi CKAD — Certified Kubernetes Application Developer"
4
+ slug: luyen-thi-ckad
5
+ description: >-
6
+ Lộ trình ôn tập toàn diện cho kỳ thi CKAD (Certified Kubernetes Application Developer).
7
+ Bao phủ đầy đủ 5 domain hands-on: App Environment & Security (25%), App Design & Build (20%),
8
+ App Deployment (20%), Services & Networking (20%), App Observability (15%).
9
+ 10 bài học kèm bài tập thực hành terminal.
10
+
11
+ featured_image: images/blog/luyen-thi-ckad-banner.png
12
+ level: intermediate
13
+ duration_hours: 28
14
+ lesson_count: 10
15
+ price: '0.00'
16
+ is_free: true
17
+ view_count: 0
18
+ average_rating: '0.00'
19
+ review_count: 0
20
+ enrollment_count: 0
21
+ meta: null
22
+ published_at: '2026-04-05T10:00:00.000000Z'
23
+ created_at: '2026-04-05T10:00:00.000000Z'
24
+
25
+ author:
26
+ id: 019c9616-d2b4-713f-9b2c-40e2e92a05cf
27
+ name: Duy Tran
28
+ avatar: avatars/7e8eb5c6-4cac-455b-a701-4060f085d501.jpeg
29
+
30
+ category:
31
+ id: 019c9616-cat9-7009-a009-000000000009
32
+ name: Luyện thi chứng chỉ
33
+ slug: luyen-thi
34
+
35
+ tags:
36
+
37
+ - name: Kubernetes
38
+ slug: kubernetes
39
+ - name: CKAD
40
+ slug: ckad
41
+ - name: CNCF
42
+ slug: cncf
43
+ - name: Chứng chỉ
44
+ slug: chung-chi
45
+ - name: DevOps
46
+ slug: devops
47
+ - name: Linux Foundation
48
+ slug: linux-foundation
49
+
50
+ quiz_slug: ckad
51
+
52
+ sections:
53
+
54
+ - id: ckad-section-01
55
+ title: "Domain 1: Application Design and Build (20%)"
56
+ description: Multi-container pods, init containers, jobs, CronJobs
57
+ sort_order: 1
58
+ lessons:
59
+ - id: ckad-d1-l01
60
+ title: "Bài 1: Multi-container Pods & Init Containers"
61
+ slug: 01-multi-container-pods
62
+ description: >-
63
+ Sidecar pattern, Ambassador, Adapter patterns.
64
+ Init containers: sequencing, use cases.
65
+ Shared volumes giữa containers. Container ports.
66
+ Ephemeral containers cho debugging.
67
+ duration_minutes: 60
68
+ is_free: true
69
+ sort_order: 1
70
+ video_url: null
71
+ - id: ckad-d1-l02
72
+ title: "Bài 2: Jobs, CronJobs & Resource Management"
73
+ slug: 02-jobs-cronjobs-resources
74
+ description: >-
75
+ Job completions, parallelism, backoffLimit.
76
+ CronJob schedule syntax, concurrencyPolicy.
77
+ Resource requests vs limits. QoS classes: Guaranteed, Burstable, BestEffort.
78
+ LimitRange, ResourceQuota.
79
+ duration_minutes: 55
80
+ is_free: true
81
+ sort_order: 2
82
+ video_url: null
83
+
84
+ - id: ckad-section-02
85
+ title: "Domain 2: Application Deployment (20%)"
86
+ description: Rolling updates, rollbacks, Helm, Kustomize, deployment strategies
87
+ sort_order: 2
88
+ lessons:
89
+ - id: ckad-d2-l01
90
+ title: "Bài 3: Rolling Updates, Rollbacks & Deployment Strategies"
91
+ slug: 03-rolling-updates-rollbacks
92
+ description: >-
93
+ RollingUpdate vs Recreate strategy. maxUnavailable, maxSurge.
94
+ kubectl rollout history/undo/status. Blue-Green deployment.
95
+ Canary deployment với labels. Pause/resume rollouts.
96
+ duration_minutes: 60
97
+ is_free: true
98
+ sort_order: 3
99
+ video_url: null
100
+ - id: ckad-d2-l02
101
+ title: "Bài 4: Helm & Kustomize Basics"
102
+ slug: 04-helm-kustomize
103
+ description: >-
104
+ Helm chart structure: Chart.yaml, values.yaml, templates/.
105
+ helm install/upgrade/rollback. Helm hooks.
106
+ Kustomize: base + overlays, patches, namePrefix.
107
+ kubectl apply -k vs helm install.
108
+ duration_minutes: 55
109
+ is_free: true
110
+ sort_order: 4
111
+ video_url: null
112
+
113
+ - id: ckad-section-03
114
+ title: "Domain 3: Application Observability and Maintenance (15%)"
115
+ description: Probes, logging, monitoring, debugging
116
+ sort_order: 3
117
+ lessons:
118
+ - id: ckad-d3-l01
119
+ title: "Bài 5: Probes, Logging & Debugging"
120
+ slug: 05-probes-logging-debugging
121
+ description: >-
122
+ Liveness, Readiness, Startup probes: httpGet, exec, tcpSocket.
123
+ probe timing: initialDelaySeconds, periodSeconds, failureThreshold.
124
+ kubectl logs, stern. kubectl exec. Debugging crashed containers.
125
+ kubectl top (metrics-server). Events và conditions.
126
+ duration_minutes: 60
127
+ is_free: true
128
+ sort_order: 5
129
+ video_url: null
130
+
131
+ - id: ckad-section-04
132
+ title: "Domain 4: Application Environment, Configuration & Security (25%)"
133
+ description: ConfigMaps, Secrets, SecurityContext, ServiceAccounts, RBAC
134
+ sort_order: 4
135
+ lessons:
136
+ - id: ckad-d4-l01
137
+ title: "Bài 6: ConfigMaps & Secrets"
138
+ slug: 06-configmaps-secrets
139
+ description: >-
140
+ ConfigMap: từ literal, file, env. Inject qua env / envFrom / volume.
141
+ Secret types: Opaque, TLS, dockerconfigjson. Base64 encoding.
142
+ Secrets as volumes vs env vars. External Secrets overview.
143
+ duration_minutes: 55
144
+ is_free: true
145
+ sort_order: 6
146
+ video_url: null
147
+ - id: ckad-d4-l02
148
+ title: "Bài 7: SecurityContext & Pod Security"
149
+ slug: 07-securitycontext-pod-security
150
+ description: >-
151
+ runAsUser, runAsGroup, fsGroup. readOnlyRootFilesystem.
152
+ capabilities: add/drop. allowPrivilegeEscalation.
153
+ Pod Security Standards: Privileged, Baseline, Restricted.
154
+ ServiceAccount: automountServiceAccountToken, projected volumes.
155
+ duration_minutes: 60
156
+ is_free: true
157
+ sort_order: 7
158
+ video_url: null
159
+ - id: ckad-d4-l03
160
+ title: "Bài 8: Resource Requests, Limits & QoS"
161
+ slug: 08-resources-qos
162
+ description: >-
163
+ CPU (millicores) vs Memory (MiB/GiB) units. requests vs limits.
164
+ OOMKilled và CPU throttling. QoS classes chi tiết.
165
+ LimitRange per container/pod. ResourceQuota per namespace.
166
+ Horizontal Pod Autoscaler (HPA) basics.
167
+ duration_minutes: 55
168
+ is_free: true
169
+ sort_order: 8
170
+ video_url: null
171
+
172
+ - id: ckad-section-05
173
+ title: "Domain 5: Services & Networking (20%)"
174
+ description: Services, Ingress, Network Policies
175
+ sort_order: 5
176
+ lessons:
177
+ - id: ckad-d5-l01
178
+ title: "Bài 9: Services & Ingress"
179
+ slug: 09-services-ingress
180
+ description: >-
181
+ ClusterIP, NodePort, LoadBalancer, ExternalName. Headless service.
182
+ port vs targetPort vs nodePort. Ingress rules, path types.
183
+ TLS termination. Ingress class. Service vs Ingress use cases.
184
+ duration_minutes: 60
185
+ is_free: true
186
+ sort_order: 9
187
+ video_url: null
188
+ - id: ckad-d5-l02
189
+ title: "Bài 10: Network Policies & CKAD Exam Strategy"
190
+ slug: 10-networkpolicies-exam-strategy
191
+ description: >-
192
+ NetworkPolicy: podSelector, namespaceSelector, ipBlock.
193
+ Ingress vs Egress rules. Default deny patterns.
194
+ CKAD exam tips: imperative kubectl commands, --dry-run=client,
195
+ time management, bookmarking docs, common task templates.
196
+ duration_minutes: 60
197
+ is_free: true
198
+ sort_order: 10
199
+ video_url: null