@@ -177,14 +177,38 @@ func runE(cmd *cobra.Command, args []string) error {
177177 config .DefaultConfig .ControlPlaneConnectivity = config .Portmap
178178
179179 // initialize kind provider
180+ // Check KIND_EXPERIMENTAL_PROVIDER directly, as the kind CLI does, so it
181+ // takes effect regardless of auto-detection results.
180182 var option cluster.ProviderOption
181- switch p := container .Runtime (); p {
182- case "podman" :
183- option = cluster .ProviderWithPodman ()
184- case "nerdctl" , "finch" , "nerdctl.lima" :
185- option = cluster .ProviderWithNerdctl (p )
186- default :
187- option = cluster .ProviderWithDocker ()
183+ if p := os .Getenv ("KIND_EXPERIMENTAL_PROVIDER" ); p != "" {
184+ switch p {
185+ case "podman" :
186+ klog .Infof ("Using podman provider due to KIND_EXPERIMENTAL_PROVIDER" )
187+ option = cluster .ProviderWithPodman ()
188+ container .SetRuntime ("podman" )
189+ case "docker" :
190+ klog .Infof ("Using docker provider due to KIND_EXPERIMENTAL_PROVIDER" )
191+ option = cluster .ProviderWithDocker ()
192+ container .SetRuntime ("docker" )
193+ case "nerdctl" , "finch" , "nerdctl.lima" :
194+ klog .Infof ("Using %s provider due to KIND_EXPERIMENTAL_PROVIDER" , p )
195+ option = cluster .ProviderWithNerdctl (p )
196+ container .SetRuntime (p )
197+ default :
198+ klog .Warningf ("Ignoring unknown KIND_EXPERIMENTAL_PROVIDER value %q" , p )
199+ }
200+ }
201+ if option == nil {
202+ p := container .DetectRuntime ()
203+ container .SetRuntime (p )
204+ switch p {
205+ case "podman" :
206+ option = cluster .ProviderWithPodman ()
207+ case "nerdctl" , "finch" , "nerdctl.lima" :
208+ option = cluster .ProviderWithNerdctl (p )
209+ default :
210+ option = cluster .ProviderWithDocker ()
211+ }
188212 }
189213 kindProvider := cluster .NewProvider (
190214 option ,
0 commit comments