Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c306367

Browse filesBrowse files
sohankunkerkarhaircommander
authored andcommitted
docs: Update KubeletConfigDropinDir doc information
Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com> Signed-off-by: Peter Hunt <pehunt@redhat.com>
1 parent d665f92 commit c306367
Copy full SHA for c306367

File tree

2 files changed

+344
-28
lines changed
Filter options

2 files changed

+344
-28
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
content_type: "reference"
3+
title: Kubelet Configuration Directory Merging
4+
weight: 50
5+
---
6+
7+
When using the kubelet's `--config-dir` flag to specify a drop-in directory for
8+
configuration, there is some specific behavior on how different types are
9+
merged.
10+
11+
Here are some examples of how different data types behave during configuration merging:
12+
13+
### Structure Fields
14+
There are two types of structure fields in a YAML structure: singular (or a
15+
scalar type) and embedded (structures that contain scalar types).
16+
The configuration merging process handles the overriding of singular and embedded struct fields to create a resulting kubelet configuration.
17+
18+
For instance, you may want a baseline kubelet configuration for all nodes, but you may want to customize the `address` and `authorization` fields.
19+
This can be done as follows:
20+
21+
Main kubelet configuration file contents:
22+
```yaml
23+
apiVersion: kubelet.config.k8s.io/v1beta1
24+
kind: KubeletConfiguration
25+
port: 20250
26+
authorization:
27+
mode: Webhook
28+
webhook:
29+
cacheAuthorizedTTL: "5m"
30+
cacheUnauthorizedTTL: "30s"
31+
serializeImagePulls: false
32+
address: "192.168.0.1"
33+
```
34+
35+
Contents of a file in `--config-dir` directory:
36+
```yaml
37+
apiVersion: kubelet.config.k8s.io/v1beta1
38+
kind: KubeletConfiguration
39+
authorization:
40+
mode: AlwaysAllow
41+
webhook:
42+
cacheAuthorizedTTL: "8m"
43+
cacheUnauthorizedTTL: "45s"
44+
address: "192.168.0.8"
45+
```
46+
47+
The resulting configuration will be as follows:
48+
```yaml
49+
apiVersion: kubelet.config.k8s.io/v1beta1
50+
kind: KubeletConfiguration
51+
port: 20250
52+
serializeImagePulls: false
53+
authorization:
54+
mode: AlwaysAllow
55+
webhook:
56+
cacheAuthorizedTTL: "8m"
57+
cacheUnauthorizedTTL: "45s"
58+
address: "192.168.0.8"
59+
```
60+
61+
### Lists
62+
You can overide the slices/lists values of the kubelet configuration.
63+
However, the entire list gets overridden during the merging process.
64+
For example, you can override the `clusterDNS` list as follows:
65+
66+
Main kubelet configuration file contents:
67+
```yaml
68+
apiVersion: kubelet.config.k8s.io/v1beta1
69+
kind: KubeletConfiguration
70+
port: 20250
71+
serializeImagePulls: false
72+
clusterDNS:
73+
- "192.168.0.9"
74+
- "192.168.0.8"
75+
```
76+
77+
Contents of a file in `--config-dir` directory:
78+
```yaml
79+
apiVersion: kubelet.config.k8s.io/v1beta1
80+
kind: KubeletConfiguration
81+
clusterDNS:
82+
- "192.168.0.2"
83+
- "192.168.0.3"
84+
- "192.168.0.5"
85+
```
86+
87+
The resulting configuration will be as follows:
88+
```yaml
89+
apiVersion: kubelet.config.k8s.io/v1beta1
90+
kind: KubeletConfiguration
91+
port: 20250
92+
serializeImagePulls: false
93+
clusterDNS:
94+
- "192.168.0.2"
95+
- "192.168.0.3"
96+
- "192.168.0.5"
97+
```
98+
99+
### Maps, including Nested Structures
100+
101+
Individual fields in maps, regardless of their value types (boolean, string, etc.), can be selectively overridden.
102+
However, for `map[string][]string`, the entire list associated with a specific field gets overridden.
103+
Let's understand this better with an example, particularly on fields like `featureGates` and `staticPodURLHeader`:
104+
105+
Main kubelet configuration file contents:
106+
```yaml
107+
apiVersion: kubelet.config.k8s.io/v1beta1
108+
kind: KubeletConfiguration
109+
port: 20250
110+
serializeImagePulls: false
111+
featureGates:
112+
AllAlpha: false
113+
MemoryQoS: true
114+
staticPodURLHeader:
115+
kubelet-api-support:
116+
- "Authorization: 234APSDFA"
117+
- "X-Custom-Header: 123"
118+
custom-static-pod:
119+
- "Authorization: 223EWRWER"
120+
- "X-Custom-Header: 456"
121+
```
122+
123+
Contents of a file in `--config-dir` directory:
124+
```yaml
125+
apiVersion: kubelet.config.k8s.io/v1beta1
126+
kind: KubeletConfiguration
127+
featureGates:
128+
MemoryQoS: false
129+
KubeletTracing: true
130+
DynamicResourceAllocation: true
131+
staticPodURLHeader:
132+
custom-static-pod:
133+
- "Authorization: 223EWRWER"
134+
- "X-Custom-Header: 345"
135+
```
136+
137+
The resulting configuration will be as follows:
138+
```yaml
139+
apiVersion: kubelet.config.k8s.io/v1beta1
140+
kind: KubeletConfiguration
141+
port: 20250
142+
serializeImagePulls: false
143+
featureGates:
144+
AllAlpha: false
145+
MemoryQoS: false
146+
KubeletTracing: true
147+
DynamicResourceAllocation: true
148+
staticPodURLHeader:
149+
kubelet-api-support:
150+
- "Authorization: 234APSDFA"
151+
- "X-Custom-Header: 123"
152+
custom-static-pod:
153+
- "Authorization: 223EWRWER"
154+
- "X-Custom-Header: 345"
155+
```

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.