@@ -45,18 +45,18 @@ Kubelet's configuration.
45453 . Update the Kubelet's correspoinding Node object to use this ConfigMap.
4646
4747Each Kubelet watches a configuration reference on its respective Node object.
48- When this reference changes, the Kubelet downloads the new configuration and
49- exits. For the feature to work correctly, you must be running a process manager
48+ When this reference changes, the Kubelet downloads the new configuration,
49+ updates a local reference to refer to the file, and exits.
50+ For the feature to work correctly, you must be running a process manager
5051(like systemd) which will restart the Kubelet when it exits. When the Kubelet is
5152restarted, it will begin using the new configuration.
5253
53- The new configuration completely overrides the old configuration; unspecified
54- fields in the new configuration will receive their canonical default values.
55- Some CLI flags do not have an associated configuration field, and will not be
56- affected by the new configuration. These fields are defined by the KubeletFlags
57- structure, [ here] ( https://github.com/kubernetes/kubernetes/blob/master/cmd/kubelet/app/options/options.go ) .
54+ The new configuration completely overrides configuration provided by ` --config ` ,
55+ and is overridden by command-line flags. Unspecified values in the new configuration
56+ will receive default values appropriate to the configuration version
57+ (e.g. ` kubelet.config.k8s.io/v1beta1 ` ), unless overridden by flags.
5858
59- The status of the Node's Kubelet configuration is reported via the ` ConfigOK `
59+ The status of the Node's Kubelet configuration is reported via the ` KubeletConfigOK `
6060condition in the Node status. Once you have updated a Node to use the new
6161ConfigMap, you can observe this condition to confirm that the Node is using the
6262intended configuration. A table describing the possible conditions can be found
@@ -95,13 +95,13 @@ and you will simply edit a copy of this file (which, as a best practice, should
9595live in version control) while creating the first Kubelet ConfigMap. Today,
9696however, the Kubelet is still bootstrapped with command-line flags. Fortunately,
9797there is a dirty trick you can use to generate a config file containing a Node's
98- current configuration. The trick involves hitting the Kubelet server's ` configz `
98+ current configuration. The trick involves accessing the Kubelet server's ` configz `
9999endpoint via the kubectl proxy. This endpoint, in its current implementation, is
100100intended to be used only as a debugging aid, which is part of why this is a
101- dirty trick. There is ongoing work to improve the endpoint, and in the future
102- this will be a less "dirty" operation. This trick also requires the ` jq ` command
103- to be installed on your machine, for unpacking and editing the JSON response
104- from the endpoint.
101+ dirty trick. The endpoint may be improved in the future, but until then
102+ it should not be relied on for production scenarios.
103+ This trick also requires the ` jq ` command to be installed on your machine,
104+ for unpacking and editing the JSON response from the endpoint.
105105
106106Do the following to generate the file:
107107
@@ -112,12 +112,12 @@ configz endpoint:
112112
113113```
114114$ export NODE_NAME=the-name-of-the-node-you-are-reconfiguring
115- $ curl -sSL http://localhost:8001/api/v1/proxy/nodes/${NODE_NAME}/configz | jq '.kubeletconfig|.kind="KubeletConfiguration"|.apiVersion="kubeletconfig/v1alpha1 "' > kubelet_configz_${NODE_NAME}
115+ $ curl -sSL http://localhost:8001/api/v1/proxy/nodes/${NODE_NAME}/configz | jq '.kubeletconfig|.kind="KubeletConfiguration"|.apiVersion="kubelet.config.k8s.io/v1beta1 "' > kubelet_configz_${NODE_NAME}
116116```
117117
118118Note that we have to manually add the ` kind ` and ` apiVersion ` to the downloaded
119119object, as these are not reported by the configz endpoint. This is one of the
120- limitations of the endpoint that is planned to be fixed in the future .
120+ limitations of the endpoint.
121121
122122### Edit the configuration file
123123
@@ -209,29 +209,29 @@ Be sure to specify all three of `name`, `namespace`, and `uid`.
209209### Observe that the Node begins using the new configuration
210210
211211Retrieve the Node with ` kubectl get node ${NODE_NAME} -o yaml ` , and look for the
212- ` ConfigOK ` condition in ` status.conditions ` . You should see the message
212+ ` KubeletConfigOK ` condition in ` status.conditions ` . You should see the message
213213` Using current (UID: CONFIG_MAP_UID) ` when the Kubelet starts using the new
214214configuration.
215215
216216For convenience, you can use the following command (using ` jq ` ) to filter down
217- to the ` ConfigOK ` condition:
217+ to the ` KubeletConfigOK ` condition:
218218
219219```
220- $ kubectl get no ${NODE_NAME} -o json | jq '.status.conditions|map(select(.type=="ConfigOK "))'
220+ $ kubectl get no ${NODE_NAME} -o json | jq '.status.conditions|map(select(.type=="KubeletConfigOK "))'
221221[
222222 {
223223 "lastHeartbeatTime": "2017-09-20T18:08:29Z",
224224 "lastTransitionTime": "2017-09-20T18:08:17Z",
225- "message": "using current (UID: \"2ebc8d1a-9e2a-11e7-a8dd-42010a800006\") ",
225+ "message": "using current: /api/v1/namespaces/kube-system/configmaps/my-node-config-gkt4c2m4b2 ",
226226 "reason": "passing all checks",
227227 "status": "True",
228- "type": "ConfigOK "
228+ "type": "KubeletConfigOK "
229229 }
230230]
231231```
232232
233233If something goes wrong, you may see one of several different error conditions,
234- detailed in the Table of ConfigOK Conditions , below. When this happens, you
234+ detailed in the table of KubeletConfigOK conditions , below. When this happens, you
235235should check the Kubelet's log for more details.
236236
237237### Edit the configuration file again
@@ -282,16 +282,16 @@ the following, with `name` and `uid` substituted as necessary:
282282```
283283configSource:
284284 configMapRef:
285- name: NEW_CONFIG_MAP_NAME
285+ name: ${ NEW_CONFIG_MAP_NAME}
286286 namespace: kube-system
287- uid: NEW_CONFIG_MAP_UID
287+ uid: ${ NEW_CONFIG_MAP_UID}
288288```
289289
290290### Observe that the Kubelet is using the new configuration
291291
292292Once more, retrieve the Node with ` kubectl get node ${NODE_NAME} -o yaml ` , and
293- look for the ` ConfigOK ` condition in ` status.conditions ` . You should the message
294- ` Using current (UID: NEW_CONFIG_MAP_UID) ` when the Kubelet starts using the
293+ look for the ` KubeletConfigOK ` condition in ` status.conditions ` . You should see the message
294+ ` using current: /api/v1/namespaces/kube-system/configmaps/${NEW_CONFIG_MAP_NAME} ` when the Kubelet starts using the
295295new configuration.
296296
297297### Deauthorize your Node fom reading the old ConfigMap
@@ -327,9 +327,8 @@ remove the `spec.configSource` subfield.
327327
328328### Observe that the Node is using its local default configuration
329329
330- After removing this subfield, you should eventually observe that the ConfigOK
331- condition's message reverts to either ` using current (default) ` or
332- ` using current (init) ` , depending on how the Node was provisioned.
330+ After removing this subfield, you should eventually observe that the KubeletConfigOK
331+ condition's message reverts to ` using current: local ` .
333332
334333### Deauthorize your Node fom reading the old ConfigMap
335334
@@ -366,9 +365,9 @@ Here is an example command that uses `kubectl patch`:
366365kubectl patch node ${NODE_NAME} -p "{\"spec\":{\"configSource\":{\"configMapRef\":{\"name\":\"${CONFIG_MAP_NAME}\",\"namespace\":\"kube-system\",\"uid\":\"${CONFIG_MAP_UID}\"}}}}"
367366```
368367
369- ## Understanding ConfigOK Conditions
368+ ## Understanding KubeletConfigOK Conditions
370369
371- The following table describes several of the ` ConfigOK ` Node conditions you
370+ The following table describes several of the ` KubeletConfigOK ` Node conditions you
372371might encounter in a cluster that has Dynamic Kubelet Config enabled. If you
373372observe a condition with ` status=False ` , you should check the Kubelet log for
374373more error details by searching for the message or reason text.
@@ -383,49 +382,33 @@ more error details by searching for the message or reason text.
383382 <th>Status</th>
384383</tr >
385384<tr >
386- <td><p>using current (default) </p></td>
387- <td><p>current is set to the local default, and no init config was provided </p></td>
385+ <td><p>using current: local </p></td>
386+ <td><p>when the config source is nil, the Kubelet uses its local config </p></td>
388387 <td><p>True</p></td>
389388</tr >
390389<tr >
391- <td><p>using current (init)</p></td>
392- <td><p>current is set to the local default, and an init config was provided</p></td>
393- <td><p>True</p></td>
394- </tr >
395- <tr >
396- <td><p>using current (UID: CURRENT_CONFIG_MAP_UID)</p></td>
390+ <td><p>using current: /api/v1/namespaces/${CURRENT_CONFIG_MAP_NAMESPACE}/configmaps/${CURRENT_CONFIG_MAP_NAME}</p></td>
397391 <td><p>passing all checks</p></td>
398392 <td><p>True</p></td>
399393</tr >
400394<tr >
401- <td><p>using last-known-good (default)</p></td>
402- <td>
403- <ul>
404- <li>failed to load current (UID: CURRENT_CONFIG_MAP_UID)</li>
405- <li>failed to parse current (UID: CURRENT_CONFIG_MAP_UID)</li>
406- <li>failed to validate current (UID: CURRENT_CONFIG_MAP_UID)</li>
407- </ul>
408- </td>
409- <td><p>False</p></td>
410- </tr >
411- <tr >
412- <td><p>using last-known-good (init)</p></td>
395+ <td><p>using last-known-good: local</p></td>
413396 <td>
414397 <ul>
415- <li>failed to load current (UID: CURRENT_CONFIG_MAP_UID) </li>
416- <li>failed to parse current (UID: CURRENT_CONFIG_MAP_UID) </li>
417- <li>failed to validate current (UID: CURRENT_CONFIG_MAP_UID) </li>
398+ <li>failed to load current: /api/v1/namespaces/${CURRENT_CONFIG_MAP_NAMESPACE}/configmaps/${CURRENT_CONFIG_MAP_NAME} </li>
399+ <li>failed to parse current: /api/v1/namespaces/${CURRENT_CONFIG_MAP_NAMESPACE}/configmaps/${CURRENT_CONFIG_MAP_NAME} </li>
400+ <li>failed to validate current: /api/v1/namespaces/${CURRENT_CONFIG_MAP_NAMESPACE}/configmaps/${CURRENT_CONFIG_MAP_NAME} </li>
418401 </ul>
419402 </td>
420403 <td><p>False</p></td>
421404</tr >
422405<tr >
423- <td><p>using last-known-good (UID: LAST_KNOWN_GOOD_CONFIG_MAP_UID) </p></td>
406+ <td><p>using last-known-good: /api/v1/namespaces/${LAST_KNOWN_GOOD_CONFIG_MAP_NAMESPACE}/configmaps/${LAST_KNOWN_GOOD_CONFIG_MAP_NAME} </p></td>
424407 <td>
425408 <ul>
426- <li>failed to load current (UID: CURRENT_CONFIG_MAP_UID) </li>
427- <li>failed to parse current (UID: CURRENT_CONFIG_MAP_UID) </li>
428- <li>failed to validate current (UID: CURRENT_CONFIG_MAP_UID) </li>
409+ <li>failed to load current: /api/v1/namespaces/${CURRENT_CONFIG_MAP_NAMESPACE}/configmaps/${CURRENT_CONFIG_MAP_NAME} </li>
410+ <li>failed to parse current: /api/v1/namespaces/${CURRENT_CONFIG_MAP_NAMESPACE}/configmaps/${CURRENT_CONFIG_MAP_NAME} </li>
411+ <li>failed to validate current: /api/v1/namespaces/${CURRENT_CONFIG_MAP_NAMESPACE}/configmaps/${CURRENT_CONFIG_MAP_NAME} </li>
429412 </ul>
430413 </td>
431414 <td><p>False</p></td>
@@ -451,15 +434,15 @@ more error details by searching for the message or reason text.
451434 <p>failed to sync, reason:</p>
452435 <ul>
453436 <li>failed to read Node from informer object cache</li>
454- <li>failed to reset to local (default or init) config</li>
437+ <li>failed to reset to local config</li>
455438 <li>invalid NodeConfigSource, exactly one subfield must be non-nil, but all were nil</li>
456439 <li>invalid ObjectReference, all of UID, Name, and Namespace must be specified</li>
457- <li>invalid ObjectReference, UID SOME_UID does not match UID of downloaded ConfigMap SOME_OTHER_UID </li>
458- <li>failed to determine whether object with UID SOME_UID was already checkpointed</li>
459- <li>failed to download ConfigMap with name SOME_NAME from namespace SOME_NAMESPACE </li>
460- <li>failed to save config checkpoint for object with UID SOME_UID </li>
461- <li>failed to set current config checkpoint to default </li>
462- <li>failed to set current config checkpoint to object with UID SOME_UID </li>
440+ <li>invalid ConfigSource.ConfigMapRef.UID: ${ UID} does not match ${API_PATH}. UID: ${UID_OF_CONFIG_MAP_AT_API_PATH} </li>
441+ <li>failed to determine whether object ${API_PATH} with UID ${UID} was already checkpointed</li>
442+ <li>failed to download ConfigMap with name ${NAME} from namespace ${NAMESPACE} </li>
443+ <li>failed to save config checkpoint for object ${API_PATH} with UID ${UID} </li>
444+ <li>failed to set current config checkpoint to local config </li>
445+ <li>failed to set current config checkpoint to object ${API_PATH} with UID ${UID} </li>
463446 </ul>
464447 </td>
465448 <td><p>False</p></td>
0 commit comments