@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.
- package/content/pages/xoa-du-lieu-nguoi-dung.md +68 -0
- 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
- 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
- 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
- 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
- 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
- package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/02-phan-2-modeling/lessons/06-bai-6-model-evaluation.md +169 -0
- 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
- 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
- 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
- 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
- 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
- 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
- package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/index.md +1 -1
- package/content/series/luyen-thi/luyen-thi-cka/chapters/01-cluster-architecture/lessons/01-kien-truc-cka-kubeadm.md +133 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/01-cluster-architecture/lessons/02-cluster-upgrade-kubeadm.md +147 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/01-cluster-architecture/lessons/03-rbac-cka.md +152 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/02-workloads-scheduling/lessons/04-deployments-daemonsets-statefulsets.md +186 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/02-workloads-scheduling/lessons/05-scheduling-taints-affinity.md +163 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/03-services-networking/lessons/06-services-endpoints-coredns.md +145 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/03-services-networking/lessons/07-ingress-networkpolicies-cni.md +172 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/04-storage/lessons/08-persistent-volumes-storageclass.md +159 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/05-troubleshooting/lessons/09-etcd-backup-restore.md +149 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/05-troubleshooting/lessons/10-troubleshooting-nodes.md +153 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/05-troubleshooting/lessons/11-troubleshooting-workloads.md +146 -0
- package/content/series/luyen-thi/luyen-thi-cka/chapters/05-troubleshooting/lessons/12-troubleshooting-networking-exam.md +170 -0
- package/content/series/luyen-thi/luyen-thi-cka/index.md +217 -0
- package/content/series/luyen-thi/luyen-thi-ckad/chapters/01-app-design-build/lessons/01-multi-container-pods.md +146 -0
- package/content/series/luyen-thi/luyen-thi-ckad/chapters/01-app-design-build/lessons/02-jobs-cronjobs-resources.md +174 -0
- package/content/series/luyen-thi/luyen-thi-ckad/chapters/02-app-deployment/lessons/03-rolling-updates-rollbacks.md +148 -0
- package/content/series/luyen-thi/luyen-thi-ckad/chapters/02-app-deployment/lessons/04-helm-kustomize.md +181 -0
- package/content/series/luyen-thi/luyen-thi-ckad/chapters/03-app-observability/lessons/05-probes-logging-debugging.md +183 -0
- package/content/series/luyen-thi/luyen-thi-ckad/chapters/04-app-environment-config/lessons/06-configmaps-secrets.md +182 -0
- package/content/series/luyen-thi/luyen-thi-ckad/chapters/04-app-environment-config/lessons/07-securitycontext-pod-security.md +168 -0
- package/content/series/luyen-thi/luyen-thi-ckad/chapters/04-app-environment-config/lessons/08-resources-qos.md +168 -0
- package/content/series/luyen-thi/luyen-thi-ckad/chapters/05-services-networking/lessons/09-services-ingress.md +182 -0
- package/content/series/luyen-thi/luyen-thi-ckad/chapters/05-services-networking/lessons/10-networkpolicies-exam-strategy.md +236 -0
- package/content/series/luyen-thi/luyen-thi-ckad/index.md +199 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/index.md +1 -1
- package/content/series/luyen-thi/luyen-thi-kcna/chapters/01-kubernetes-fundamentals/lessons/01-kien-truc-kubernetes.md +137 -0
- package/content/series/luyen-thi/luyen-thi-kcna/chapters/01-kubernetes-fundamentals/lessons/02-pods-workloads-controllers.md +142 -0
- package/content/series/luyen-thi/luyen-thi-kcna/chapters/01-kubernetes-fundamentals/lessons/03-services-networking-storage.md +155 -0
- package/content/series/luyen-thi/luyen-thi-kcna/chapters/01-kubernetes-fundamentals/lessons/04-rbac-security.md +137 -0
- package/content/series/luyen-thi/luyen-thi-kcna/chapters/02-container-orchestration/lessons/05-container-runtimes-oci.md +137 -0
- package/content/series/luyen-thi/luyen-thi-kcna/chapters/02-container-orchestration/lessons/06-orchestration-patterns.md +147 -0
- package/content/series/luyen-thi/luyen-thi-kcna/chapters/03-cloud-native-architecture/lessons/07-cloud-native-architecture.md +143 -0
- package/content/series/luyen-thi/luyen-thi-kcna/chapters/04-observability-delivery/lessons/08-observability.md +143 -0
- package/content/series/luyen-thi/luyen-thi-kcna/chapters/04-observability-delivery/lessons/09-helm-gitops-cicd.md +162 -0
- package/content/series/luyen-thi/luyen-thi-kcna/index.md +168 -0
- package/data/quizzes.json +1059 -0
- package/package.json +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: lt-cka-series-001
|
|
3
|
+
title: "Luyện thi CKA — Certified Kubernetes Administrator"
|
|
4
|
+
slug: luyen-thi-cka
|
|
5
|
+
description: >-
|
|
6
|
+
Lộ trình ôn tập toàn diện cho kỳ thi CKA (Certified Kubernetes Administrator).
|
|
7
|
+
Bao phủ đầy đủ 5 domain hands-on: Troubleshooting (30%), Cluster Architecture (25%),
|
|
8
|
+
Services & Networking (20%), Workloads & Scheduling (15%), Storage (10%).
|
|
9
|
+
12 bài học kèm bài tập thực hành terminal.
|
|
10
|
+
|
|
11
|
+
featured_image: images/blog/luyen-thi-cka-banner.png
|
|
12
|
+
level: intermediate
|
|
13
|
+
duration_hours: 35
|
|
14
|
+
lesson_count: 12
|
|
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: CKA
|
|
40
|
+
slug: cka
|
|
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: cka
|
|
51
|
+
|
|
52
|
+
sections:
|
|
53
|
+
|
|
54
|
+
- id: cka-section-01
|
|
55
|
+
title: "Domain 1: Cluster Architecture, Installation & Configuration (25%)"
|
|
56
|
+
description: kubeadm, RBAC, cluster upgrade, etcd backup/restore
|
|
57
|
+
sort_order: 1
|
|
58
|
+
lessons:
|
|
59
|
+
- id: cka-d1-l01
|
|
60
|
+
title: "Bài 1: Kubernetes Architecture & kubeadm Cluster Setup"
|
|
61
|
+
slug: 01-kien-truc-cka-kubeadm
|
|
62
|
+
description: >-
|
|
63
|
+
Control plane components sâu. kubeadm init, join, config.
|
|
64
|
+
High Availability cluster topology. Certificate rotation.
|
|
65
|
+
kubectl config, contexts, kubeconfig.
|
|
66
|
+
duration_minutes: 65
|
|
67
|
+
is_free: true
|
|
68
|
+
sort_order: 1
|
|
69
|
+
video_url: null
|
|
70
|
+
- id: cka-d1-l02
|
|
71
|
+
title: "Bài 2: Cluster Upgrade với kubeadm"
|
|
72
|
+
slug: 02-cluster-upgrade-kubeadm
|
|
73
|
+
description: >-
|
|
74
|
+
Upgrade strategy: control plane → worker nodes.
|
|
75
|
+
drain, cordon, uncordon. Version skew policy.
|
|
76
|
+
kubeadm upgrade plan/apply. Rollback procedures.
|
|
77
|
+
duration_minutes: 60
|
|
78
|
+
is_free: true
|
|
79
|
+
sort_order: 2
|
|
80
|
+
video_url: null
|
|
81
|
+
- id: cka-d1-l03
|
|
82
|
+
title: "Bài 3: RBAC — Role-Based Access Control"
|
|
83
|
+
slug: 03-rbac-cka
|
|
84
|
+
description: >-
|
|
85
|
+
Role vs ClusterRole. RoleBinding vs ClusterRoleBinding.
|
|
86
|
+
ServiceAccounts và token. kubectl auth can-i.
|
|
87
|
+
Aggregated ClusterRoles. Least privilege patterns.
|
|
88
|
+
duration_minutes: 60
|
|
89
|
+
is_free: true
|
|
90
|
+
sort_order: 3
|
|
91
|
+
video_url: null
|
|
92
|
+
|
|
93
|
+
- id: cka-section-02
|
|
94
|
+
title: "Domain 2: Workloads & Scheduling (15%)"
|
|
95
|
+
description: Deployments, DaemonSets, scheduling, taints/tolerations, affinity
|
|
96
|
+
sort_order: 2
|
|
97
|
+
lessons:
|
|
98
|
+
- id: cka-d2-l01
|
|
99
|
+
title: "Bài 4: Deployments, DaemonSets & StatefulSets"
|
|
100
|
+
slug: 04-deployments-daemonsets-statefulsets
|
|
101
|
+
description: >-
|
|
102
|
+
Rolling update strategies. Rollback. ReplicaSet vs Deployment.
|
|
103
|
+
DaemonSet use cases. StatefulSet: headless service, volumeClaimTemplates.
|
|
104
|
+
Resource requests & limits. QoS classes.
|
|
105
|
+
duration_minutes: 60
|
|
106
|
+
is_free: true
|
|
107
|
+
sort_order: 4
|
|
108
|
+
video_url: null
|
|
109
|
+
- id: cka-d2-l02
|
|
110
|
+
title: "Bài 5: Scheduling — Taints, Tolerations & Affinity"
|
|
111
|
+
slug: 05-scheduling-taints-affinity
|
|
112
|
+
description: >-
|
|
113
|
+
Manual scheduling (nodeName, nodeSelector). Node Affinity/Anti-affinity.
|
|
114
|
+
Pod Affinity/Anti-affinity. Taints & Tolerations.
|
|
115
|
+
Priority Classes. Resource quotas & LimitRanges.
|
|
116
|
+
duration_minutes: 60
|
|
117
|
+
is_free: true
|
|
118
|
+
sort_order: 5
|
|
119
|
+
video_url: null
|
|
120
|
+
|
|
121
|
+
- id: cka-section-03
|
|
122
|
+
title: "Domain 3: Services & Networking (20%)"
|
|
123
|
+
description: Services, DNS, Ingress, NetworkPolicies, CNI
|
|
124
|
+
sort_order: 3
|
|
125
|
+
lessons:
|
|
126
|
+
- id: cka-d3-l01
|
|
127
|
+
title: "Bài 6: Services, Endpoints & CoreDNS"
|
|
128
|
+
slug: 06-services-endpoints-coredns
|
|
129
|
+
description: >-
|
|
130
|
+
ClusterIP, NodePort, LoadBalancer, ExternalName, Headless.
|
|
131
|
+
Endpoints & EndpointSlices. CoreDNS configuration.
|
|
132
|
+
Service discovery patterns. kube-proxy modes (iptables, IPVS).
|
|
133
|
+
duration_minutes: 60
|
|
134
|
+
is_free: true
|
|
135
|
+
sort_order: 6
|
|
136
|
+
video_url: null
|
|
137
|
+
- id: cka-d3-l02
|
|
138
|
+
title: "Bài 7: Ingress, Network Policies & CNI"
|
|
139
|
+
slug: 07-ingress-networkpolicies-cni
|
|
140
|
+
description: >-
|
|
141
|
+
Ingress controllers (nginx). Ingress rules, TLS.
|
|
142
|
+
NetworkPolicy: ingress/egress rules, label selectors.
|
|
143
|
+
CNI plugins: Calico, Flannel, Cilium overview.
|
|
144
|
+
Pod CIDR vs Service CIDR.
|
|
145
|
+
duration_minutes: 65
|
|
146
|
+
is_free: true
|
|
147
|
+
sort_order: 7
|
|
148
|
+
video_url: null
|
|
149
|
+
|
|
150
|
+
- id: cka-section-04
|
|
151
|
+
title: "Domain 4: Storage (10%)"
|
|
152
|
+
description: PV, PVC, StorageClass, volumes
|
|
153
|
+
sort_order: 4
|
|
154
|
+
lessons:
|
|
155
|
+
- id: cka-d4-l01
|
|
156
|
+
title: "Bài 8: Persistent Volumes, PVCs & StorageClass"
|
|
157
|
+
slug: 08-persistent-volumes-storageclass
|
|
158
|
+
description: >-
|
|
159
|
+
PersistentVolume, PersistentVolumeClaim lifecycle. Access modes.
|
|
160
|
+
Reclaim policies. StorageClass & dynamic provisioning.
|
|
161
|
+
hostPath, emptyDir, NFS. VolumeMount vs VolumeFrom.
|
|
162
|
+
duration_minutes: 55
|
|
163
|
+
is_free: true
|
|
164
|
+
sort_order: 8
|
|
165
|
+
video_url: null
|
|
166
|
+
|
|
167
|
+
- id: cka-section-05
|
|
168
|
+
title: "Domain 5: Troubleshooting (30%)"
|
|
169
|
+
description: Node, workload, networking troubleshooting, etcd backup
|
|
170
|
+
sort_order: 5
|
|
171
|
+
lessons:
|
|
172
|
+
- id: cka-d5-l01
|
|
173
|
+
title: "Bài 9: etcd Backup & Restore"
|
|
174
|
+
slug: 09-etcd-backup-restore
|
|
175
|
+
description: >-
|
|
176
|
+
etcd architecture. etcdctl snapshot save/restore.
|
|
177
|
+
Environment variables: ETCDCTL_API, certificates.
|
|
178
|
+
Static pod manifest cho etcd. Recovery procedures.
|
|
179
|
+
Encryption at rest configuration.
|
|
180
|
+
duration_minutes: 55
|
|
181
|
+
is_free: true
|
|
182
|
+
sort_order: 9
|
|
183
|
+
video_url: null
|
|
184
|
+
- id: cka-d5-l02
|
|
185
|
+
title: "Bài 10: Troubleshooting Nodes & Cluster"
|
|
186
|
+
slug: 10-troubleshooting-nodes
|
|
187
|
+
description: >-
|
|
188
|
+
Node NotReady: kubelet, container runtime issues.
|
|
189
|
+
journalctl, systemctl debugging. Certificate issues.
|
|
190
|
+
Control plane component failures. Static pods.
|
|
191
|
+
kubectl describe node, kubectl get events.
|
|
192
|
+
duration_minutes: 60
|
|
193
|
+
is_free: true
|
|
194
|
+
sort_order: 10
|
|
195
|
+
video_url: null
|
|
196
|
+
- id: cka-d5-l03
|
|
197
|
+
title: "Bài 11: Troubleshooting Workloads"
|
|
198
|
+
slug: 11-troubleshooting-workloads
|
|
199
|
+
description: >-
|
|
200
|
+
Pod stuck states: Pending, CrashLoopBackOff, ImagePullBackOff, OOMKilled.
|
|
201
|
+
kubectl logs, exec, describe. Init container debugging.
|
|
202
|
+
Resource constraints. Liveness/Readiness probe failures.
|
|
203
|
+
duration_minutes: 60
|
|
204
|
+
is_free: true
|
|
205
|
+
sort_order: 11
|
|
206
|
+
video_url: null
|
|
207
|
+
- id: cka-d5-l04
|
|
208
|
+
title: "Bài 12: Troubleshooting Networking & Exam Strategy"
|
|
209
|
+
slug: 12-troubleshooting-networking-exam
|
|
210
|
+
description: >-
|
|
211
|
+
DNS resolution failures. Service not reachable. kube-proxy issues.
|
|
212
|
+
Network policy blocking traffic. nslookup, curl debugging.
|
|
213
|
+
CKA exam tips: time management, kubectl shortcuts, imperative commands.
|
|
214
|
+
duration_minutes: 60
|
|
215
|
+
is_free: true
|
|
216
|
+
sort_order: 12
|
|
217
|
+
video_url: null
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: ckad-d1-l01
|
|
3
|
+
title: 'Bài 1: Multi-container Pods & Init Containers'
|
|
4
|
+
slug: 01-multi-container-pods
|
|
5
|
+
description: >-
|
|
6
|
+
Multi-container Pod patterns: Sidecar, Ambassador, Adapter. Init Containers
|
|
7
|
+
cho prerequisites. Shared volumes giữa containers. CKAD hands-on tasks.
|
|
8
|
+
duration_minutes: 55
|
|
9
|
+
is_free: true
|
|
10
|
+
video_url: null
|
|
11
|
+
sort_order: 1
|
|
12
|
+
section_title: "Domain 1: Application Design and Build (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-bai1-multicontainer.png" alt="Multi-Container Pod Patterns — Sidecar, Ambassador, Adapter và Init Containers" style="max-width: 800px; width: 100%; border-radius: 12px;" />
|
|
20
|
+
|
|
21
|
+
<h2 id="multi-container">1. Multi-container Pod Patterns</h2>
|
|
22
|
+
|
|
23
|
+
<p>Containers trong cùng một Pod chia sẻ: network (same IP), IPC, và có thể chia sẻ storage volumes. Dùng nhiều containers khi chúng cần phối hợp chặt chẽ.</p>
|
|
24
|
+
|
|
25
|
+
<table>
|
|
26
|
+
<thead><tr><th>Pattern</th><th>Vai trò</th><th>Ví dụ thực tế</th></tr></thead>
|
|
27
|
+
<tbody>
|
|
28
|
+
<tr><td><strong>Sidecar</strong></td><td>Extend/enhance container chính (cùng lifecycle)</td><td>Log shipper, service mesh proxy (Envoy), config reloader</td></tr>
|
|
29
|
+
<tr><td><strong>Ambassador</strong></td><td>Proxy traffic đến/từ container chính</td><td>Local proxy cache, connection multiplexer</td></tr>
|
|
30
|
+
<tr><td><strong>Adapter</strong></td><td>Transform output của container chính</td><td>Metrics format converter (app → Prometheus format)</td></tr>
|
|
31
|
+
</tbody>
|
|
32
|
+
</table>
|
|
33
|
+
|
|
34
|
+
<pre><code class="language-text">Sidecar Pattern:
|
|
35
|
+
┌─────────────────────────────────────────────┐
|
|
36
|
+
│ POD │
|
|
37
|
+
│ ┌──────────────┐ ┌─────────────────┐ │
|
|
38
|
+
│ │ App │ │ Log Sidecar │ │
|
|
39
|
+
│ │ Container │ │ (Fluentd) │ │
|
|
40
|
+
│ └──────┬───────┘ └────────┬────────┘ │
|
|
41
|
+
│ │ │ │
|
|
42
|
+
│ └──── Shared Volume ──┘ │
|
|
43
|
+
│ /var/log/app │
|
|
44
|
+
└─────────────────────────────────────────────┘</code></pre>
|
|
45
|
+
|
|
46
|
+
<h2 id="multi-container-yaml">2. Multi-container Pod YAML</h2>
|
|
47
|
+
|
|
48
|
+
<pre><code class="language-text">apiVersion: v1
|
|
49
|
+
kind: Pod
|
|
50
|
+
metadata:
|
|
51
|
+
name: web-with-sidecar
|
|
52
|
+
spec:
|
|
53
|
+
containers:
|
|
54
|
+
- name: web
|
|
55
|
+
image: nginx:1.21
|
|
56
|
+
volumeMounts:
|
|
57
|
+
- name: shared-logs
|
|
58
|
+
mountPath: /var/log/nginx
|
|
59
|
+
|
|
60
|
+
- name: log-shipper
|
|
61
|
+
image: fluent/fluentd:v1.14
|
|
62
|
+
volumeMounts:
|
|
63
|
+
- name: shared-logs
|
|
64
|
+
mountPath: /var/log/nginx
|
|
65
|
+
readOnly: true # Sidecar reads, doesn't write
|
|
66
|
+
|
|
67
|
+
volumes:
|
|
68
|
+
- name: shared-logs
|
|
69
|
+
emptyDir: {} # Ephemeral, lost when pod deleted</code></pre>
|
|
70
|
+
|
|
71
|
+
<blockquote><p><strong>Exam tip:</strong> CKAD thường cho task tạo Pod với sidecar container. Key điểm: cần shared volume để containers communicate, và cả 2 containers phải mount volume đúng path. Sidecar thường mount <code>readOnly: true</code>.</p></blockquote>
|
|
72
|
+
|
|
73
|
+
<h2 id="init-containers">3. Init Containers</h2>
|
|
74
|
+
|
|
75
|
+
<p><strong>Init Containers</strong> chạy trước main containers, phải hoàn thành thành công trước khi Pod start. Dùng cho: DB migration, wait for dependency, pre-populate volume.</p>
|
|
76
|
+
|
|
77
|
+
<pre><code class="language-text">apiVersion: v1
|
|
78
|
+
kind: Pod
|
|
79
|
+
metadata:
|
|
80
|
+
name: app-with-init
|
|
81
|
+
spec:
|
|
82
|
+
initContainers:
|
|
83
|
+
- name: wait-for-db
|
|
84
|
+
image: busybox
|
|
85
|
+
command: ['sh', '-c', 'until nc -z postgres-service 5432; do sleep 2; done']
|
|
86
|
+
|
|
87
|
+
- name: db-migrate
|
|
88
|
+
image: myapp:1.0
|
|
89
|
+
command: ['python', 'manage.py', 'migrate']
|
|
90
|
+
|
|
91
|
+
containers:
|
|
92
|
+
- name: app
|
|
93
|
+
image: myapp:1.0
|
|
94
|
+
ports:
|
|
95
|
+
- containerPort: 8000</code></pre>
|
|
96
|
+
|
|
97
|
+
<table>
|
|
98
|
+
<thead><tr><th>Property</th><th>Init Container</th><th>Regular Container</th></tr></thead>
|
|
99
|
+
<tbody>
|
|
100
|
+
<tr><td>Execution order</td><td>Sequential, all before app</td><td>Parallel start</td></tr>
|
|
101
|
+
<tr><td>Must complete?</td><td>Yes (exit 0)</td><td>Runs continuously</td></tr>
|
|
102
|
+
<tr><td>Liveness probe</td><td>Not supported</td><td>Supported</td></tr>
|
|
103
|
+
<tr><td>Resources</td><td>Counted separately</td><td>Normal requests/limits</td></tr>
|
|
104
|
+
</tbody>
|
|
105
|
+
</table>
|
|
106
|
+
|
|
107
|
+
<h2 id="cheatsheet">4. Cheat Sheet</h2>
|
|
108
|
+
|
|
109
|
+
<table>
|
|
110
|
+
<thead><tr><th>Câu hỏi exam</th><th>Đáp án</th></tr></thead>
|
|
111
|
+
<tbody>
|
|
112
|
+
<tr><td>Log collection từ app container?</td><td><strong>Sidecar</strong> với shared volume</td></tr>
|
|
113
|
+
<tr><td>Wait for service before starting?</td><td><strong>Init Container</strong></td></tr>
|
|
114
|
+
<tr><td>Run DB migration before app?</td><td><strong>Init Container</strong> với migration command</td></tr>
|
|
115
|
+
<tr><td>Shared storage giữa containers?</td><td><strong>emptyDir</strong> volume</td></tr>
|
|
116
|
+
</tbody>
|
|
117
|
+
</table>
|
|
118
|
+
|
|
119
|
+
<h2 id="practice">5. Practice Questions</h2>
|
|
120
|
+
|
|
121
|
+
<p><strong>Q1:</strong> You need to ensure a Pod's main application only starts after a config file is downloaded from an external URL. What is the best approach?</p>
|
|
122
|
+
<ul>
|
|
123
|
+
<li>A) Use a Sidecar container to download the file</li>
|
|
124
|
+
<li>B) Use an Init Container that runs wget and completes before the main container starts ✓</li>
|
|
125
|
+
<li>C) Use a DaemonSet to pre-populate config on all nodes</li>
|
|
126
|
+
<li>D) Mount a ConfigMap as the initial configuration</li>
|
|
127
|
+
</ul>
|
|
128
|
+
<p><em>Explanation: Init Containers run sequentially before main containers and must complete (exit 0). They're perfect for "prerequisites" like downloading config, waiting for services, or running migrations. Sidecar runs in parallel alongside the main container.</em></p>
|
|
129
|
+
|
|
130
|
+
<p><strong>Q2:</strong> Two containers in the same Pod need to share data. Container A writes to /tmp/data, Container B reads from /tmp/data. What should you configure?</p>
|
|
131
|
+
<ul>
|
|
132
|
+
<li>A) ExternalDNS shared volume</li>
|
|
133
|
+
<li>B) emptyDir volume mounted at /tmp/data in both containers ✓</li>
|
|
134
|
+
<li>C) A PersistentVolumeClaim for each container</li>
|
|
135
|
+
<li>D) ConfigMap mounted as a volume</li>
|
|
136
|
+
</ul>
|
|
137
|
+
<p><em>Explanation: emptyDir is created when a Pod is assigned to a Node, and deleted when the Pod is removed. It's perfect for sharing ephemeral data between containers in the same Pod. Both containers mount it at the same path.</em></p>
|
|
138
|
+
|
|
139
|
+
<p><strong>Q3:</strong> A Pod has a single Init Container that keeps failing (exit code 1). What happens to the main application container?</p>
|
|
140
|
+
<ul>
|
|
141
|
+
<li>A) The main container starts after a timeout</li>
|
|
142
|
+
<li>B) The main container is skipped and the Pod succeeds</li>
|
|
143
|
+
<li>C) The main container never starts; Pod shows Init:Error or Init:CrashLoopBackOff ✓</li>
|
|
144
|
+
<li>D) The init container failure is ignored if main container is defined</li>
|
|
145
|
+
</ul>
|
|
146
|
+
<p><em>Explanation: Init Containers MUST exit with code 0. If they fail, Kubernetes restarts them based on Pod's restartPolicy. The main container never starts until all init containers complete successfully.</em></p>
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: ckad-d1-l02
|
|
3
|
+
title: 'Bài 2: Jobs, CronJobs & Resource Management'
|
|
4
|
+
slug: 02-jobs-cronjobs-resources
|
|
5
|
+
description: >-
|
|
6
|
+
Jobs (batch tasks), CronJobs (scheduled tasks). Resource requests và limits,
|
|
7
|
+
LimitRange, ResourceQuota. QoS classes cho CKAD exam.
|
|
8
|
+
duration_minutes: 55
|
|
9
|
+
is_free: true
|
|
10
|
+
video_url: null
|
|
11
|
+
sort_order: 2
|
|
12
|
+
section_title: "Domain 1: Application Design and Build (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-bai2-jobs.png" alt="Jobs và CronJobs — completions, parallelism, concurrencyPolicy" style="max-width: 800px; width: 100%; border-radius: 12px;" />
|
|
20
|
+
|
|
21
|
+
<h2 id="jobs">1. Jobs</h2>
|
|
22
|
+
|
|
23
|
+
<p>Một <strong>Job</strong> tạo một hoặc nhiều Pods và đảm bảo chúng hoàn thành thành công. Khi Job hoàn thành, Pods không bị xóa (cho log inspection).</p>
|
|
24
|
+
|
|
25
|
+
<pre><code class="language-text">apiVersion: batch/v1
|
|
26
|
+
kind: Job
|
|
27
|
+
metadata:
|
|
28
|
+
name: data-processor
|
|
29
|
+
spec:
|
|
30
|
+
completions: 3 # Run 3 successful completions
|
|
31
|
+
parallelism: 2 # Run 2 pods at a time
|
|
32
|
+
backoffLimit: 4 # Retry up to 4 times on failure
|
|
33
|
+
template:
|
|
34
|
+
spec:
|
|
35
|
+
restartPolicy: Never # OnFailure or Never (required for Job)
|
|
36
|
+
containers:
|
|
37
|
+
- name: processor
|
|
38
|
+
image: busybox
|
|
39
|
+
command: ['sh', '-c', 'echo Processing; sleep 5']</code></pre>
|
|
40
|
+
|
|
41
|
+
<table>
|
|
42
|
+
<thead><tr><th>Field</th><th>Ý nghĩa</th><th>Default</th></tr></thead>
|
|
43
|
+
<tbody>
|
|
44
|
+
<tr><td><code>completions</code></td><td>Số lần phải hoàn thành</td><td>1</td></tr>
|
|
45
|
+
<tr><td><code>parallelism</code></td><td>Số Pods chạy concurrent</td><td>1</td></tr>
|
|
46
|
+
<tr><td><code>backoffLimit</code></td><td>Số lần retry khi fail</td><td>6</td></tr>
|
|
47
|
+
<tr><td><code>activeDeadlineSeconds</code></td><td>Timeout tổng thể của Job</td><td>Unlimited</td></tr>
|
|
48
|
+
</tbody>
|
|
49
|
+
</table>
|
|
50
|
+
|
|
51
|
+
<blockquote><p><strong>Exam tip:</strong> Job Pods phải có <code>restartPolicy: Never</code> hoặc <code>OnFailure</code>. Không thể dùng <code>Always</code> (default cho regular Pods). CKAD hay test việc tạo Job và kiểm tra completion status.</p></blockquote>
|
|
52
|
+
|
|
53
|
+
<h2 id="cronjobs">2. CronJobs</h2>
|
|
54
|
+
|
|
55
|
+
<pre><code class="language-text">apiVersion: batch/v1
|
|
56
|
+
kind: CronJob
|
|
57
|
+
metadata:
|
|
58
|
+
name: nightly-backup
|
|
59
|
+
spec:
|
|
60
|
+
schedule: "0 2 * * *" # Cron syntax: minute hour day month weekday
|
|
61
|
+
concurrencyPolicy: Forbid # Allow | Forbid | Replace
|
|
62
|
+
successfulJobsHistoryLimit: 3
|
|
63
|
+
failedJobsHistoryLimit: 1
|
|
64
|
+
jobTemplate:
|
|
65
|
+
spec:
|
|
66
|
+
template:
|
|
67
|
+
spec:
|
|
68
|
+
restartPolicy: OnFailure
|
|
69
|
+
containers:
|
|
70
|
+
- name: backup
|
|
71
|
+
image: backup-tool:1.0
|
|
72
|
+
command: ['./backup.sh']</code></pre>
|
|
73
|
+
|
|
74
|
+
<table>
|
|
75
|
+
<thead><tr><th>concurrencyPolicy</th><th>Hành vi</th></tr></thead>
|
|
76
|
+
<tbody>
|
|
77
|
+
<tr><td><strong>Allow</strong></td><td>Cho phép Jobs chạy concurrent (default)</td></tr>
|
|
78
|
+
<tr><td><strong>Forbid</strong></td><td>Skip new Job nếu previous chưa xong</td></tr>
|
|
79
|
+
<tr><td><strong>Replace</strong></td><td>Cancel previous Job, start new one</td></tr>
|
|
80
|
+
</tbody>
|
|
81
|
+
</table>
|
|
82
|
+
|
|
83
|
+
<h2 id="resources">3. Resource Requests & Limits</h2>
|
|
84
|
+
|
|
85
|
+
<pre><code class="language-text">spec:
|
|
86
|
+
containers:
|
|
87
|
+
- name: app
|
|
88
|
+
image: myapp
|
|
89
|
+
resources:
|
|
90
|
+
requests:
|
|
91
|
+
cpu: "250m" # 0.25 CPU core (minimum guaranteed)
|
|
92
|
+
memory: "128Mi" # 128 MiB minimum
|
|
93
|
+
limits:
|
|
94
|
+
cpu: "500m" # Max 0.5 CPU core
|
|
95
|
+
memory: "256Mi" # Max 256 MiB (OOM if exceeded)</code></pre>
|
|
96
|
+
|
|
97
|
+
<pre><code class="language-text">QoS Classes (dựa trên requests/limits):
|
|
98
|
+
|
|
99
|
+
Guaranteed: requests == limits (both CPU and memory)
|
|
100
|
+
→ Last to be evicted under pressure
|
|
101
|
+
|
|
102
|
+
Burstable: requests < limits (or only one set)
|
|
103
|
+
→ Middle priority for eviction
|
|
104
|
+
|
|
105
|
+
BestEffort: NO requests, NO limits
|
|
106
|
+
→ First to be evicted under pressure</code></pre>
|
|
107
|
+
|
|
108
|
+
<blockquote><p><strong>Exam tip:</strong> Để Pod có QoS class <strong>Guaranteed</strong>: phải set cả <code>cpu</code> và <code>memory</code> trong cả <code>requests</code> và <code>limits</code>, và chúng phải bằng nhau. Mỗi container trong Pod đều phải thỏa mãn điều kiện này.</p></blockquote>
|
|
109
|
+
|
|
110
|
+
<h2 id="limitrange">4. LimitRange & ResourceQuota</h2>
|
|
111
|
+
|
|
112
|
+
<table>
|
|
113
|
+
<thead><tr><th>Object</th><th>Scope</th><th>Mục đích</th></tr></thead>
|
|
114
|
+
<tbody>
|
|
115
|
+
<tr><td><strong>LimitRange</strong></td><td>Namespace</td><td>Set default requests/limits cho Pods/Containers trong namespace</td></tr>
|
|
116
|
+
<tr><td><strong>ResourceQuota</strong></td><td>Namespace</td><td>Giới hạn tổng resources namespace được dùng</td></tr>
|
|
117
|
+
</tbody>
|
|
118
|
+
</table>
|
|
119
|
+
|
|
120
|
+
<pre><code class="language-text">ResourceQuota example:
|
|
121
|
+
apiVersion: v1
|
|
122
|
+
kind: ResourceQuota
|
|
123
|
+
metadata:
|
|
124
|
+
name: dev-quota
|
|
125
|
+
namespace: development
|
|
126
|
+
spec:
|
|
127
|
+
hard:
|
|
128
|
+
requests.cpu: "4"
|
|
129
|
+
requests.memory: "8Gi"
|
|
130
|
+
limits.cpu: "8"
|
|
131
|
+
limits.memory: "16Gi"
|
|
132
|
+
pods: "20"</code></pre>
|
|
133
|
+
|
|
134
|
+
<h2 id="cheatsheet">5. Cheat Sheet</h2>
|
|
135
|
+
|
|
136
|
+
<table>
|
|
137
|
+
<thead><tr><th>Câu hỏi exam</th><th>Đáp án</th></tr></thead>
|
|
138
|
+
<tbody>
|
|
139
|
+
<tr><td>Job cần restartPolicy gì?</td><td><code>Never</code> hoặc <code>OnFailure</code></td></tr>
|
|
140
|
+
<tr><td>CronJob mỗi 5 phút?</td><td><code>*/5 * * * *</code></td></tr>
|
|
141
|
+
<tr><td>Container bị OOM Kill do gì?</td><td>Vượt <code>limits.memory</code></td></tr>
|
|
142
|
+
<tr><td>QoS Guaranteed cần gì?</td><td>requests == limits (cả CPU và Memory)</td></tr>
|
|
143
|
+
<tr><td>Giới hạn resources của namespace?</td><td><strong>ResourceQuota</strong></td></tr>
|
|
144
|
+
</tbody>
|
|
145
|
+
</table>
|
|
146
|
+
|
|
147
|
+
<h2 id="practice">6. Practice Questions</h2>
|
|
148
|
+
|
|
149
|
+
<p><strong>Q1:</strong> A Job is configured with completions: 5 and parallelism: 2. How does it execute?</p>
|
|
150
|
+
<ul>
|
|
151
|
+
<li>A) Creates 5 Pods simultaneously until all complete</li>
|
|
152
|
+
<li>B) Runs 2 Pods at a time, creating new ones as old ones complete, until 5 total completions ✓</li>
|
|
153
|
+
<li>C) Runs 5 Pods sequentially one by one</li>
|
|
154
|
+
<li>D) Creates 2 Pods, each completing 2.5 times</li>
|
|
155
|
+
</ul>
|
|
156
|
+
<p><em>Explanation: completions=5 means 5 PODs must exit successfully. parallelism=2 means at most 2 run at once. As each Pod completes, a new one starts until completion count is reached. Total Pods created could be more if some fail.</em></p>
|
|
157
|
+
|
|
158
|
+
<p><strong>Q2:</strong> A Pod has no resource requests or limits set. What QoS class is it assigned and how does this affect eviction?</p>
|
|
159
|
+
<ul>
|
|
160
|
+
<li>A) Guaranteed — it will be last to be evicted</li>
|
|
161
|
+
<li>B) Burstable — it has medium eviction priority</li>
|
|
162
|
+
<li>C) BestEffort — it will be first to be evicted under resource pressure ✓</li>
|
|
163
|
+
<li>D) NoQoS — it has no eviction priority</li>
|
|
164
|
+
</ul>
|
|
165
|
+
<p><em>Explanation: Pods with no resource requests or limits get BestEffort QoS class. When nodes face resource pressure, Kubernetes evicts BestEffort Pods first to free resources for higher-priority workloads.</em></p>
|
|
166
|
+
|
|
167
|
+
<p><strong>Q3:</strong> A CronJob is scheduled every hour. A previous job is still running when the next scheduled time arrives. With concurrencyPolicy: Forbid, what happens?</p>
|
|
168
|
+
<ul>
|
|
169
|
+
<li>A) The running job is cancelled; the new one starts</li>
|
|
170
|
+
<li>B) Both jobs run concurrently</li>
|
|
171
|
+
<li>C) The new job is skipped; the running job continues ✓</li>
|
|
172
|
+
<li>D) The CronJob is suspended until the running job completes</li>
|
|
173
|
+
</ul>
|
|
174
|
+
<p><em>Explanation: Forbid policy prevents a new job from starting if the previous job is still running. The scheduled run is skipped. Use Allow to permit concurrent runs or Replace to cancel the old and start the new one.</em></p>
|