Skip to content

Commit 96a656d

Browse files
authored
Merge pull request #46064 from windsonsea/configy
Make a task prettier: kubelet-config-file
2 parents 4f2dd5a + 9647701 commit 96a656d

File tree

1 file changed

+150
-148
lines changed

1 file changed

+150
-148
lines changed

content/en/docs/tasks/administer-cluster/kubelet-config-file.md

Lines changed: 150 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The configuration file must be a JSON or YAML representation of the parameters
3838
in this struct. Make sure the kubelet has read permissions on the file.
3939

4040
Here is an example of what this file might look like:
41+
4142
```yaml
4243
apiVersion: kubelet.config.k8s.io/v1beta1
4344
kind: KubeletConfiguration
@@ -54,9 +55,10 @@ evictionHard:
5455
In this example, the kubelet is configured with the following settings:
5556
5657
1. `address`: The kubelet will serve on IP address `192.168.0.8`.
57-
2. `port`: The kubelet will serve on port `20250`.
58-
3. `serializeImagePulls`: Image pulls will be done in parallel.
59-
4. `evictionHard`: The kubelet will evict Pods under one of the following conditions:
58+
1. `port`: The kubelet will serve on port `20250`.
59+
1. `serializeImagePulls`: Image pulls will be done in parallel.
60+
1. `evictionHard`: The kubelet will evict Pods under one of the following conditions:
61+
6062
- When the node's available memory drops below 100MiB.
6163
- When the node's main filesystem's available space is less than 10%.
6264
- When the image filesystem's available space is less than 15%.
@@ -119,10 +121,9 @@ stored internally in the kubelet.
119121
This offers you flexibility in how you manage and combine kubelet configuration that comes from different sources.
120122
However, it's important to note that the behavior varies based on the data type of the configuration fields.
121123

122-
Different data types in the kubelet configuration structure merge differently.
123-
See the [reference
124-
document](/docs/reference/node/kubelet-config-directory-merging.md) for more
125-
information.
124+
Different data types in the kubelet configuration structure merge differently. See the
125+
[reference document](/docs/reference/node/kubelet-config-directory-merging.md)
126+
for more information.
126127

127128
### Kubelet configuration merging order
128129

@@ -135,8 +136,9 @@ On startup, the kubelet merges configuration from:
135136

136137
{{< note >}}
137138
The config drop-in dir mechanism for the kubelet is similar but different from how the `kubeadm` tool allows you to patch configuration.
138-
The `kubeadm` tool uses a specific [patching strategy](/docs/setup/production-environment/tools/kubeadm/control-plane-flags/#patches) for its configuration,
139-
whereas the only patch strategy for kubelet configuration drop-in files is `replace`. The kubelet determines the order of merges based on sorting the **suffixes** alphanumerically,
139+
The `kubeadm` tool uses a specific [patching strategy](/docs/setup/production-environment/tools/kubeadm/control-plane-flags/#patches)
140+
for its configuration, whereas the only patch strategy for kubelet configuration drop-in files is `replace`.
141+
The kubelet determines the order of merges based on sorting the **suffixes** alphanumerically,
140142
and replaces every field present in a higher priority file.
141143
{{< /note >}}
142144

@@ -147,144 +149,144 @@ they can follow these steps to inspect the kubelet configuration:
147149

148150
1. Start a proxy server using [`kubectl proxy`](/docs/reference/kubectl/generated/kubectl-commands#proxy) in your terminal.
149151

150-
```bash
151-
kubectl proxy
152-
```
153-
154-
Which gives output like:
155-
156-
```bash
157-
Starting to serve on 127.0.0.1:8001
158-
159-
```
160-
2. Open another terminal window and use `curl` to fetch the kubelet configuration.
161-
Replace `<node-name>` with the actual name of your node:
162-
163-
```bash
164-
curl -X GET http://127.0.0.1:8001/api/v1/nodes/<node-name>/proxy/configz | jq .
165-
```
166-
167-
```bash
168-
{
169-
"kubeletconfig": {
170-
"enableServer": true,
171-
"staticPodPath": "/var/run/kubernetes/static-pods",
172-
"syncFrequency": "1m0s",
173-
"fileCheckFrequency": "20s",
174-
"httpCheckFrequency": "20s",
175-
"address": "192.168.1.16",
176-
"port": 10250,
177-
"readOnlyPort": 10255,
178-
"tlsCertFile": "/var/lib/kubelet/pki/kubelet.crt",
179-
"tlsPrivateKeyFile": "/var/lib/kubelet/pki/kubelet.key",
180-
"rotateCertificates": true,
181-
"authentication": {
182-
"x509": {
183-
"clientCAFile": "/var/run/kubernetes/client-ca.crt"
184-
},
185-
"webhook": {
186-
"enabled": true,
187-
"cacheTTL": "2m0s"
188-
},
189-
"anonymous": {
190-
"enabled": true
191-
}
192-
},
193-
"authorization": {
194-
"mode": "AlwaysAllow",
195-
"webhook": {
196-
"cacheAuthorizedTTL": "5m0s",
197-
"cacheUnauthorizedTTL": "30s"
198-
}
199-
},
200-
"registryPullQPS": 5,
201-
"registryBurst": 10,
202-
"eventRecordQPS": 50,
203-
"eventBurst": 100,
204-
"enableDebuggingHandlers": true,
205-
"healthzPort": 10248,
206-
"healthzBindAddress": "127.0.0.1",
207-
"oomScoreAdj": -999,
208-
"clusterDomain": "cluster.local",
209-
"clusterDNS": [
210-
"10.0.0.10"
211-
],
212-
"streamingConnectionIdleTimeout": "4h0m0s",
213-
"nodeStatusUpdateFrequency": "10s",
214-
"nodeStatusReportFrequency": "5m0s",
215-
"nodeLeaseDurationSeconds": 40,
216-
"imageMinimumGCAge": "2m0s",
217-
"imageMaximumGCAge": "0s",
218-
"imageGCHighThresholdPercent": 85,
219-
"imageGCLowThresholdPercent": 80,
220-
"volumeStatsAggPeriod": "1m0s",
221-
"cgroupsPerQOS": true,
222-
"cgroupDriver": "systemd",
223-
"cpuManagerPolicy": "none",
224-
"cpuManagerReconcilePeriod": "10s",
225-
"memoryManagerPolicy": "None",
226-
"topologyManagerPolicy": "none",
227-
"topologyManagerScope": "container",
228-
"runtimeRequestTimeout": "2m0s",
229-
"hairpinMode": "promiscuous-bridge",
230-
"maxPods": 110,
231-
"podPidsLimit": -1,
232-
"resolvConf": "/run/systemd/resolve/resolv.conf",
233-
"cpuCFSQuota": true,
234-
"cpuCFSQuotaPeriod": "100ms",
235-
"nodeStatusMaxImages": 50,
236-
"maxOpenFiles": 1000000,
237-
"contentType": "application/vnd.kubernetes.protobuf",
238-
"kubeAPIQPS": 50,
239-
"kubeAPIBurst": 100,
240-
"serializeImagePulls": true,
241-
"evictionHard": {
242-
"imagefs.available": "15%",
243-
"memory.available": "100Mi",
244-
"nodefs.available": "10%",
245-
"nodefs.inodesFree": "5%"
246-
},
247-
"evictionPressureTransitionPeriod": "1m0s",
248-
"enableControllerAttachDetach": true,
249-
"makeIPTablesUtilChains": true,
250-
"iptablesMasqueradeBit": 14,
251-
"iptablesDropBit": 15,
252-
"featureGates": {
253-
"AllAlpha": false
254-
},
255-
"failSwapOn": false,
256-
"memorySwap": {},
257-
"containerLogMaxSize": "10Mi",
258-
"containerLogMaxFiles": 5,
259-
"configMapAndSecretChangeDetectionStrategy": "Watch",
260-
"enforceNodeAllocatable": [
261-
"pods"
262-
],
263-
"volumePluginDir": "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/",
264-
"logging": {
265-
"format": "text",
266-
"flushFrequency": "5s",
267-
"verbosity": 3,
268-
"options": {
269-
"json": {
270-
"infoBufferSize": "0"
271-
}
272-
}
273-
},
274-
"enableSystemLogHandler": true,
275-
"enableSystemLogQuery": false,
276-
"shutdownGracePeriod": "0s",
277-
"shutdownGracePeriodCriticalPods": "0s",
278-
"enableProfilingHandler": true,
279-
"enableDebugFlagsHandler": true,
280-
"seccompDefault": false,
281-
"memoryThrottlingFactor": 0.9,
282-
"registerNode": true,
283-
"localStorageCapacityIsolation": true,
284-
"containerRuntimeEndpoint": "unix:///var/run/crio/crio.sock"
285-
}
286-
}
287-
```
152+
```bash
153+
kubectl proxy
154+
```
155+
156+
Which gives output like:
157+
158+
```none
159+
Starting to serve on 127.0.0.1:8001
160+
```
161+
162+
1. Open another terminal window and use `curl` to fetch the kubelet configuration.
163+
Replace `<node-name>` with the actual name of your node:
164+
165+
```bash
166+
curl -X GET http://127.0.0.1:8001/api/v1/nodes/<node-name>/proxy/configz | jq .
167+
```
168+
169+
```json
170+
{
171+
"kubeletconfig": {
172+
"enableServer": true,
173+
"staticPodPath": "/var/run/kubernetes/static-pods",
174+
"syncFrequency": "1m0s",
175+
"fileCheckFrequency": "20s",
176+
"httpCheckFrequency": "20s",
177+
"address": "192.168.1.16",
178+
"port": 10250,
179+
"readOnlyPort": 10255,
180+
"tlsCertFile": "/var/lib/kubelet/pki/kubelet.crt",
181+
"tlsPrivateKeyFile": "/var/lib/kubelet/pki/kubelet.key",
182+
"rotateCertificates": true,
183+
"authentication": {
184+
"x509": {
185+
"clientCAFile": "/var/run/kubernetes/client-ca.crt"
186+
},
187+
"webhook": {
188+
"enabled": true,
189+
"cacheTTL": "2m0s"
190+
},
191+
"anonymous": {
192+
"enabled": true
193+
}
194+
},
195+
"authorization": {
196+
"mode": "AlwaysAllow",
197+
"webhook": {
198+
"cacheAuthorizedTTL": "5m0s",
199+
"cacheUnauthorizedTTL": "30s"
200+
}
201+
},
202+
"registryPullQPS": 5,
203+
"registryBurst": 10,
204+
"eventRecordQPS": 50,
205+
"eventBurst": 100,
206+
"enableDebuggingHandlers": true,
207+
"healthzPort": 10248,
208+
"healthzBindAddress": "127.0.0.1",
209+
"oomScoreAdj": -999,
210+
"clusterDomain": "cluster.local",
211+
"clusterDNS": [
212+
"10.0.0.10"
213+
],
214+
"streamingConnectionIdleTimeout": "4h0m0s",
215+
"nodeStatusUpdateFrequency": "10s",
216+
"nodeStatusReportFrequency": "5m0s",
217+
"nodeLeaseDurationSeconds": 40,
218+
"imageMinimumGCAge": "2m0s",
219+
"imageMaximumGCAge": "0s",
220+
"imageGCHighThresholdPercent": 85,
221+
"imageGCLowThresholdPercent": 80,
222+
"volumeStatsAggPeriod": "1m0s",
223+
"cgroupsPerQOS": true,
224+
"cgroupDriver": "systemd",
225+
"cpuManagerPolicy": "none",
226+
"cpuManagerReconcilePeriod": "10s",
227+
"memoryManagerPolicy": "None",
228+
"topologyManagerPolicy": "none",
229+
"topologyManagerScope": "container",
230+
"runtimeRequestTimeout": "2m0s",
231+
"hairpinMode": "promiscuous-bridge",
232+
"maxPods": 110,
233+
"podPidsLimit": -1,
234+
"resolvConf": "/run/systemd/resolve/resolv.conf",
235+
"cpuCFSQuota": true,
236+
"cpuCFSQuotaPeriod": "100ms",
237+
"nodeStatusMaxImages": 50,
238+
"maxOpenFiles": 1000000,
239+
"contentType": "application/vnd.kubernetes.protobuf",
240+
"kubeAPIQPS": 50,
241+
"kubeAPIBurst": 100,
242+
"serializeImagePulls": true,
243+
"evictionHard": {
244+
"imagefs.available": "15%",
245+
"memory.available": "100Mi",
246+
"nodefs.available": "10%",
247+
"nodefs.inodesFree": "5%"
248+
},
249+
"evictionPressureTransitionPeriod": "1m0s",
250+
"enableControllerAttachDetach": true,
251+
"makeIPTablesUtilChains": true,
252+
"iptablesMasqueradeBit": 14,
253+
"iptablesDropBit": 15,
254+
"featureGates": {
255+
"AllAlpha": false
256+
},
257+
"failSwapOn": false,
258+
"memorySwap": {},
259+
"containerLogMaxSize": "10Mi",
260+
"containerLogMaxFiles": 5,
261+
"configMapAndSecretChangeDetectionStrategy": "Watch",
262+
"enforceNodeAllocatable": [
263+
"pods"
264+
],
265+
"volumePluginDir": "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/",
266+
"logging": {
267+
"format": "text",
268+
"flushFrequency": "5s",
269+
"verbosity": 3,
270+
"options": {
271+
"json": {
272+
"infoBufferSize": "0"
273+
}
274+
}
275+
},
276+
"enableSystemLogHandler": true,
277+
"enableSystemLogQuery": false,
278+
"shutdownGracePeriod": "0s",
279+
"shutdownGracePeriodCriticalPods": "0s",
280+
"enableProfilingHandler": true,
281+
"enableDebugFlagsHandler": true,
282+
"seccompDefault": false,
283+
"memoryThrottlingFactor": 0.9,
284+
"registerNode": true,
285+
"localStorageCapacityIsolation": true,
286+
"containerRuntimeEndpoint": "unix:///var/run/crio/crio.sock"
287+
}
288+
}
289+
```
288290

289291
<!-- discussion -->
290292

@@ -294,4 +296,4 @@ curl -X GET http://127.0.0.1:8001/api/v1/nodes/<node-name>/proxy/configz | jq .
294296
[`KubeletConfiguration`](/docs/reference/config-api/kubelet-config.v1beta1/)
295297
reference.
296298
- Learn more about kubelet configuration merging in the
297-
[reference document](/docs/reference/node/kubelet-config-directory-merging.md).
299+
[reference document](/docs/reference/node/kubelet-config-directory-merging.md).

0 commit comments

Comments
 (0)