You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/blog/_posts/2025-11-11-kubernetes-configuration-best-practices/index.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,22 +25,24 @@ kubectl api-resources
25
25
This simple step saves you from future compatibility issues.
26
26
27
27
### Store configuration in version control
28
-
Never apply YAML files directly from your desktop. Always keep them in a version control system like Git, it's your safety net.
28
+
Never apply manifest files directly from your desktop. Always keep them in a version control system like Git, it's your safety net.
29
29
If something breaks, you can instantly roll back to a previous commit, compare changes or recreate your cluster setup without panic.
30
30
31
31
### Write configs in YAML not JSON
32
32
Write your configuration files using YAML rather than JSON. Both work technically, but YAML is just easier for humans. It's cleaner to read and less noisy and widely used in the community.
33
33
34
-
> Note: YAML has some sneaky gotchas with booleans.
34
+
YAML has some sneaky gotchas with boolean values:
35
35
Use only `true` or `false`.
36
36
Don't write `yes`, `no`, `on` or `off`.
37
37
They might work in one version of YAML but break in another. To be safe, quote anything that looks like a Boolean (for example `"yes"`).
38
38
39
39
### Keep configuration simple and minimal
40
-
Avoid setting default values that are already handled by Kubernetes. Minimal YAMLs are easier to debug, cleaner to review and less likely to break things later.
40
+
Avoid setting default values that are already handled by Kubernetes. Minimal manifests are easier to debug, cleaner to review and less likely to break things later.
41
41
42
42
### Group related objects together
43
-
If your Deployment, Service and ConfigMap all belong to one app, put them in a single YAML file. It's easier to track changes and apply them as a unit. See the [Guestbook all-in-one.yaml](https://github.com/kubernetes/examples/blob/master/web/guestbook/all-in-one/guestbook-all-in-one.yaml) file as an example of this syntax.
43
+
If your Deployment, Service and ConfigMap all belong to one app, put them in a single manifest file.
44
+
It's easier to track changes and apply them as a unit.
45
+
See the [Guestbook all-in-one.yaml](https://github.com/kubernetes/examples/blob/master/web/guestbook/all-in-one/guestbook-all-in-one.yaml) file for an example of this syntax.
44
46
45
47
You can even apply entire directories with:
46
48
```bash
@@ -49,14 +51,14 @@ kubectl apply -f configs/
49
51
One command and boom everything in that folder gets deployed.
50
52
51
53
### Add helpful annotations
52
-
YAML files are not just for machines, they are for humans too. Use annotations to describe why something exists or what it does. A quick one-liner can save hours when debugging later and also allows better collaboration.
54
+
Manifest files are not just for machines, they are for humans too. Use annotations to describe why something exists or what it does. A quick one-liner can save hours when debugging later and also allows better collaboration.
53
55
54
56
The most helpful annotation to set is `kubernetes.io/description`. It's like using comment, except that it gets copied into the API so that everyone else can see it even after you deploy.
55
57
56
58
## Managing Workloads: Pods, Deployments, and Jobs
57
59
58
-
Most of us started our Kubernetes journey by creating Pods directly.
59
-
While Pods are the building blocks of Kubernetes, using them directly is like driving without a seatbelt, it works until something crashes.
60
+
A common early mistake in Kubernetes is creating Pods directly. Pods work, but they don't reschedule themselves if something goes wrong.
61
+
60
62
_Naked Pods_ (Pods not managed by a controller, such as [Deployment](/docs/concepts/workloads/controllers/deployment/) or a [StatefulSet](/docs/concepts/workloads/controllers/statefulset/)) are fine for testing, but in real setups, they are risky.
61
63
62
64
Why?
@@ -168,7 +170,7 @@ That’s a super underrated trick every Kubernetes engineer should know.
168
170
169
171
## Handy kubectl tips
170
172
171
-
These small tips make life much easier when you are working with multiple YAMLs or clusters.
173
+
These small tips make life much easier when you are working with multiple manifest files or clusters.
172
174
173
175
### Apply entire directories
174
176
Instead of applying one file at a time, apply the whole folder:
0 commit comments