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: keps/sig-node/3085-pod-conditions-for-starting-completition-of-sandbox-creation/README.md
+166-9
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,7 @@ tags, and then generate with `hack/update-toc.sh`.
93
93
-[Story 3: Pod unable to start due to problems with CSI, CNI or Runtime Handler plugins](#story-3-pod-unable-to-start-due-to-problems-with-csi-cni-or-runtime-handler-plugins)
94
94
-[Story 4: Pod Sandbox restart after a successful initial startup and crash](#story-4-pod-sandbox-restart-after-a-successful-initial-startup-and-crash)
95
95
-[Story 5: Graceful pod sandbox termination](#story-5-graceful-pod-sandbox-termination)
These are some areas that are useful to deduce information around volume failures.
739
+
`PodReadyToStartContainers` gives a useful condition for these cases.
740
+
741
+
###### Mounting Volumes from missing Secrets
742
+
743
+
A pod is configured to mount a volume from a secret. The corresponding secret is missing so the volume mount fails.
744
+
745
+
###### Mounting Volumes from missing ConfigMaps
746
+
747
+
A pod is configured to mount a volume from a ConfigMap. The corresponding Configmap is missing so the volume mount fails.
748
+
749
+
In both of these cases, it is possible to deduce a failure but you would have view the events. Without this condition, the latest status is `ContainerCreating` and no conditions help to distinguish this issue.
750
+
751
+
Events are best-effort so they are not guaranteed to happen. In many cases, it is possible that these events are missed and users are left confused
752
+
on why there containers are stuck. The `PodReadyToStartContainers` adds a condition to reflect a failure in these cases. Both of these cases fail in the volume initialization phase so `PodReadyToStartContainers` would be set to `False` giving users notification that their pods had an issue.
- Add test to check status of pod ready to start condition are set to false after terminating
1016
+
-[] Volume Mounting Issues
1017
+
-[x] Add test to verify sandbox condition for missing configmap.
1018
+
-[ ] Add test to verify sandbox condition for missing secret.
1019
+
991
1020
E2E tests will be introduced to cover the user scenarios mentioned above. Tests
992
1021
will involve launching pods with characteristics mentioned below and
993
1022
examining the pod status has the new `PodReadyToStartContainers` condition with
994
1023
`status` and `reason` fields populated with expected values:
1024
+
995
1025
1. A basic pod that launches successfully without any problems.
996
1026
2. A pod with references to a configmap (as a volume) that has not been created causing the pod sandbox creation to not complete until the configmap is created later.
997
-
3. A pod whose node is rebooted leading to the sandbox being recreated.
1027
+
3. A pod with references to a secret (as a volume) that has not been created causing the pod sandbox creation to not complete until the secret is created later.
1028
+
4. A pod whose node is rebooted leading to the sandbox being recreated.
998
1029
999
1030
Tests for pod conditions in the `GracefulNodeShutdown` e2e_node test will be
1000
1031
enhanced to check the status of the new pod sandbox conditions are `false` after
@@ -1069,14 +1100,17 @@ in back-to-back releases.
1069
1100
#### Alpha
1070
1101
1071
1102
- Kubelet will report pod sandbox conditions if the feature flag `PodReadyToStartContainersCondition` is enabled.
1072
-
- Initial e2e tests completed and enabled.
1103
+
- E2E tests added for pod conditions.
1104
+
- E2E test for sandbox condition if pod fails to mount volume.
1073
1105
1074
1106
#### Beta
1075
1107
1108
+
- Condition is moved from a package constant in Kubelet to a [API Defined Condition](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api/core/v1/types.go#L2834)
1076
1109
- Gather feedback from cluster operators and developers of services or controllers that consume these conditions.
1077
1110
- Implement suggestions from feedback as feasible.
1078
1111
- Feature Flag defaults to enabled.
1079
-
- Add more test cases and link to this KEP.
1112
+
- Add test case for graceful shutdown.
1113
+
- Add test case for sandbox condition if pod fails to mount volume from a missing secret.
1080
1114
1081
1115
#### GA
1082
1116
@@ -1171,7 +1205,8 @@ Any change of default behavior may be surprising to users or break existing
1171
1205
automations, so be extremely careful here.
1172
1206
-->
1173
1207
1174
-
No changes to any default behavior should result from enabling the feature.
1208
+
Yes, there will be a new condition for all pods.
1209
+
In normal cases, the `PodReadyToStartContainers` condition will be set to true.
1175
1210
1176
1211
###### Can the feature be disabled once it has been enabled (i.e. can we roll back the enablement)?
1177
1212
@@ -1203,6 +1238,7 @@ used to confirm that the new pod condition introduced is being:
1203
1238
- evaluated and applied by the Kubelet Status manager when the feature is enabled.
1204
1239
- not evaluated nor applied when the feature is disabled.
1205
1240
1241
+
1206
1242
### Rollout, Upgrade and Rollback Planning
1207
1243
1208
1244
<!--
@@ -1231,6 +1267,12 @@ before the rollback. This helps prevent a controller/service consuming the
1231
1267
condition getting the data from pods running in a subset of the nodes in the
1232
1268
middle of a rollout or rollback.
1233
1269
1270
+
If a controller or service consumes these pod conditions but the cluster has turned off this feature,
1271
+
the controller or service will never match on this pod condition as new pods will never set this condition.
1272
+
1273
+
If the feature is rolled back and the conditions are set, the controller or service will never see a new condition update.
1274
+
Conditions can assume to be locked in place as no future patches will done to this condition.
1275
+
1234
1276
###### What specific metrics should inform a rollback?
1235
1277
1236
1278
<!--
@@ -1262,11 +1304,105 @@ Longer term, we may want to require automated upgrade/rollback tests, but we
1262
1304
are missing a bunch of machinery and tooling and can't do that now.
1263
1305
-->
1264
1306
1265
-
Upgrade/downgrade of Kubelet incorporating this feature (preceded with draining
1266
-
of pods) has been tested successfully.
1307
+
In the [node-e2e tests](https://github.com/kubernetes/kubernetes/blob/master/test/e2e_node/pod_conditions_test.go#L46), we test upgrade and rollback via toggling the feature gates on/off.
1308
+
1309
+
The Upgrade->downgrade->upgrade testing was done manually using the `alpha`
1310
+
version in 1.28 with the following steps:
1311
+
1312
+
1. Start the cluster with the `PodReadyToStartContainersCondition` enabled:
Create a pod that has a failed pod sandbox. Easiest way to do this is to create a pod that fails to mount a volume. This case fails because the ConfigMap (`clusters-config-file`) does not exist.
1331
+
1332
+
using `pod.yaml`:
1333
+
1334
+
```yaml
1335
+
apiVersion: v1
1336
+
kind: Pod
1337
+
metadata:
1338
+
name: config-map-mount
1339
+
spec:
1340
+
containers:
1341
+
- name: test-container
1342
+
image: registry.k8s.io/busybox
1343
+
command: [ "/bin/sh", "-c", "env" ]
1344
+
volumeMounts:
1345
+
- mountPath: /clusters-config
1346
+
name: clusters-config-volume
1347
+
volumes:
1348
+
- configMap:
1349
+
name: clusters-config-file
1350
+
name: clusters-config-volume
1351
+
```
1267
1352
1268
-
New pods scheduled on the node after un-cordoning following node
1269
-
upgrade/downgrade surface the expected pod conditions.
1353
+
```sh
1354
+
kubectl create -f pod.yaml
1355
+
```
1356
+
1357
+
This pod will have a `PodReadyToStartContainers` condition that says `False`.
1358
+
1359
+
```yaml
1360
+
conditions:
1361
+
- lastProbeTime: null
1362
+
lastTransitionTime: "2023-10-03T22:14:22Z"
1363
+
status: "False"
1364
+
type: PodReadyToStartContainers
1365
+
```
1366
+
1367
+
2. To test the downgrade, we create a new kind cluster with the feature turned off.
1368
+
1369
+
```yaml
1370
+
kind: Cluster
1371
+
apiVersion: kind.x-k8s.io/v1alpha4
1372
+
featureGates:
1373
+
"PodReadyToStartContainersCondition": false
1374
+
nodes:
1375
+
- role: control-plane
1376
+
- role: worker
1377
+
```
1378
+
1379
+
When you inspect the conditions, the `PodReadyToStartContainers` condition will be not existent.
1380
+
1381
+
3. To test the enable, we create a new kind cluster with the feature turned on.
1382
+
1383
+
```yaml
1384
+
kind: Cluster
1385
+
apiVersion: kind.x-k8s.io/v1alpha4
1386
+
featureGates:
1387
+
"PodReadyToStartContainersCondition": true
1388
+
nodes:
1389
+
- role: control-plane
1390
+
- role: worker
1391
+
```
1392
+
1393
+
This pod will have a `PodReadyToStartContainers` condition that says `False`.
1394
+
1395
+
```yaml
1396
+
conditions:
1397
+
- lastProbeTime: null
1398
+
lastTransitionTime: "2023-10-03T22:14:22Z"
1399
+
status: "False"
1400
+
type: PodReadyToStartContainers
1401
+
```
1402
+
1403
+
This demonstrates that the feature is working again for the job.
1404
+
1405
+
If you take a pod that is able to create a sandbox, then you should see `True` in cases where the condition exists.
1270
1406
1271
1407
###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?
1272
1408
@@ -1333,6 +1469,8 @@ These goals will help you determine what you need to measure (SLIs) in the next
1333
1469
question.
1334
1470
-->
1335
1471
1472
+
There are no SLOs for this feature. We don't expect any changes to the existing SLOs.
1473
+
1336
1474
###### What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service?
1337
1475
1338
1476
<!--
@@ -1413,7 +1551,7 @@ Focusing mostly on:
1413
1551
1414
1552
Yes, the new pod condition will result in the Kubelet Status Manager making additional PATCH calls on the pod status fields.
1415
1553
1416
-
The Kubelet Status Manager already has infrastructure to cache pod status updates (including pod conditions) and issue the PATCH es in a batch.
1554
+
The Kubelet Status Manager already has infrastructure to cache pod status updates (including pod conditions) and issue the PATCH in a batch.
1417
1555
1418
1556
###### Will enabling / using this feature result in introducing new API types?
1419
1557
@@ -1474,6 +1612,20 @@ This through this both in small and large cases, again with respect to the
1474
1612
1475
1613
No
1476
1614
1615
+
###### Can enabling / using this feature result in resource exhaustion of some node resources (PIDs, sockets, inodes, etc.)?
1616
+
1617
+
<!--
1618
+
Focus not just on happy cases, but primarily on more pathological cases
1619
+
(e.g. probes taking a minute instead of milliseconds, failed pods consuming resources, etc.).
1620
+
If any of the resources can be exhausted, how this is mitigated with the existing limits
1621
+
(e.g. pods per node) or new limits added by this KEP?
1622
+
1623
+
Are there any tests that were run/should be run to understand performance characteristics better
1624
+
and validate the declared limits?
1625
+
-->
1626
+
1627
+
No.
1628
+
1477
1629
### Troubleshooting
1478
1630
1479
1631
<!--
@@ -1523,6 +1675,11 @@ may leverage this feature.
1523
1675
1524
1676
## Implementation History
1525
1677
1678
+
- Alpha in 1.25.
1679
+
- PodHasNetwork renamed to PodReadyToStartContainers in 1.28.
1680
+
- Beta promotion to 1.29
1681
+
- Moving PodReadyToStartContainers to staging/src/k8s.io/api/core/v1/types.go as a API constant
1682
+
1526
1683
<!--
1527
1684
Major milestones in the lifecycle of a KEP should be tracked in this section.
0 commit comments