@@ -1325,13 +1325,19 @@ func testKubeletPropagation(ctx context.Context, mgtClient, guestClient crclient
13251325 g .Expect (p .Status .Phase ).To (BeElementOf (corev1 .PodSucceeded , corev1 .PodFailed ))
13261326 }).WithTimeout (5 * time .Minute ).WithPolling (5 * time .Second ).Should (Succeed ())
13271327
1328- // Always fetch and log the pod output so it's visible in the test run
1329- logReq := guestClientset .CoreV1 ().Pods (checkerPod .Namespace ).GetLogs (checkerPod .Name , & corev1.PodLogOptions {Container : "checker" })
1330- logStream , err := logReq .Stream (ctx )
1331- g .Expect (err ).NotTo (HaveOccurred ())
1332- defer logStream .Close ()
1333- logBytes , err := io .ReadAll (logStream )
1334- g .Expect (err ).NotTo (HaveOccurred ())
1328+ // Fetch pod output with retries — the kubelet serving cert on freshly
1329+ // provisioned Karpenter nodes may not be ready immediately after the
1330+ // node is marked Ready, causing transient TLS or HTTP/2 errors on the
1331+ // proxied log request.
1332+ var logBytes []byte
1333+ g .Eventually (func (g Gomega ) {
1334+ logReq := guestClientset .CoreV1 ().Pods (checkerPod .Namespace ).GetLogs (checkerPod .Name , & corev1.PodLogOptions {Container : "checker" })
1335+ logStream , err := logReq .Stream (ctx )
1336+ g .Expect (err ).NotTo (HaveOccurred ())
1337+ defer logStream .Close ()
1338+ logBytes , err = io .ReadAll (logStream )
1339+ g .Expect (err ).NotTo (HaveOccurred ())
1340+ }).WithTimeout (2 * time .Minute ).WithPolling (10 * time .Second ).Should (Succeed ())
13351341 t .Logf ("kubelet-config-checker output:\n %s" , string (logBytes ))
13361342
13371343 // Assert the pod succeeded (grep chain exited 0 = all fields found)
0 commit comments