Change:
It appears that the kubelet will detect and use the cloud provider as detected by cadvisor thus overriding the cloud provider passed in at runtime: This will break our private cloud configuration where we do not use our cloud provider's load balancing and instead use our own load balancing tier. In my opinion, the cloud provider specified at kubelet runtime should be respected for the node. Am I reading this correctly? Any thoughts on how to handle this properly? Thank you!
If you specify any cloud provider through flags, it will be used by kubelet (see ). It's only when you don't specify any cloud provider that kubelet will detect the cloud provider from the machine info, as described by the comment.
that's exactly my situation, I want to run in our private cloud environment without any of the cloud integration. If I specify cloud-provider="" at runtime it will get overridden.
Ah I see. I guess specifying an empty string is the same as not specifying any cloud provider. This auto-detection feature was introduced by /cc the author and reviewer to see if this is an intended behavior:
Legitimate concern. I'm posting a fix. Do you consider this to be a regression or are you just getting started with k8s.
I am sorry, This was not the original intention. We can keep the auto detection with a flag, or make a flag to ask kubelet not to do it. Unless there is a way to see if the variable was assigned to that I missed. I can post a fix tomorrow if it won't exit by then.
Thank you. We're running on 1.2.4 and won't be running on 1.3 for a few months yet anyways and was just testing to look for future issues when I found this.
I assigned this issue to you since , and I can't assign this to anyway :-)
Thanks for testing our 1.3 release candidate, and reporting this regression to us. We are including the fix to 1.3.

Discussion:
// When these values are updated, also update test/e2e/framework/util.go defaultPodInfraContainerImageName    = "gcr.io/google_containers/pause" defaultPodInfraContainerImageVersion = "3.0" <ins> // Auto detect cloud provider. AutoDetectCloudProvider = "auto-detect" </ins> ) // Returns the arch-specific pause image that kubelet should use as the default

VolumeStatsAggPeriod:         unversioned.Duration{Duration: time.Minute}, CertDirectory:                "/var/run/kubernetes", CgroupRoot:                   "", <ins> CloudProvider:                AutoDetectCloudProvider, </ins> ConfigureCBR0:                false, ContainerRuntime:             "docker", RuntimeRequestTimeout:        unversioned.Duration{Duration: 2 * time.Minute},

fs.StringVar(&s.NetworkPluginName, "network-plugin", s.NetworkPluginName, "<Warning: Alpha feature> The name of the network plugin to be invoked for various events in kubelet/pod lifecycle") fs.StringVar(&s.NetworkPluginDir, "network-plugin-dir", s.NetworkPluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for network plugins") fs.StringVar(&s.VolumePluginDir, "volume-plugin-dir", s.VolumePluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for additional third party volume plugins") <del> fs.StringVar(&s.CloudProvider, "cloud-provider", s.CloudProvider, "The provider for cloud services.  Empty string for no provider.") </del> <ins> fs.StringVar(&s.CloudProvider, "cloud-provider", s.CloudProvider, "The provider for cloud services. By default, kubelet will attempt to auto-detect the cloud provider. Specify empty string for running with no cloud provider. [default=auto-detect]") </ins> fs.StringVar(&s.CloudConfigFile, "cloud-config", s.CloudConfigFile, "The path to the cloud provider configuration file.  Empty string for no configuration file.") fs.StringVar(&s.KubeletCgroups, "resource-container", s.KubeletCgroups, "Optional absolute name of the resource-only container to create and run the Kubelet in.")

glog.Warningf("No API client: %v", err) } <del> cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile) if err != nil { return err </del> <ins> if s.CloudProvider == options.AutoDetectCloudProvider { kcfg.AutoDetectCloudProvider = true } else { cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile) if err != nil { return err } glog.V(2).Infof("Successfully initialized cloud provider: %q from the config file: %qn", s.CloudProvider, s.CloudConfigFile) kcfg.Cloud = cloud </ins> } <del> glog.V(2).Infof("Successfully initialized cloud provider: %q from the config file: %qn", s.CloudProvider, s.CloudConfigFile) kcfg.Cloud = cloud </del> } if kcfg.CAdvisorInterface == nil {

Address                        net.IP AllowPrivileged                bool Auth                           server.AuthInterface <ins> AutoDetectCloudProvider        bool </ins> Builder                        KubeletBuilder CAdvisorInterface              cadvisor.Interface VolumeStatsAggPeriod           time.Duration

kc.ImageGCPolicy, kc.DiskSpacePolicy, kc.Cloud, <ins> kc.AutoDetectCloudProvider, </ins> kc.NodeLabels, kc.NodeStatusUpdateFrequency, kc.OSInterface,

imageGCPolicy ImageGCPolicy, diskSpacePolicy DiskSpacePolicy, cloud cloudprovider.Interface, <ins> autoDetectCloudProvider bool, </ins> nodeLabels map[string]string, nodeStatusUpdateFrequency time.Duration, osInterface kubecontainer.OSInterface,

cadvisor:                       cadvisorInterface, diskSpaceManager:               diskSpaceManager, cloud:                          cloud, <del> nodeRef:                        nodeRef, nodeLabels:                     nodeLabels, nodeStatusUpdateFrequency:      nodeStatusUpdateFrequency, </del> <ins> autoDetectCloudProvider:   autoDetectCloudProvider, nodeRef:                   nodeRef, nodeLabels:                nodeLabels, nodeStatusUpdateFrequency: nodeStatusUpdateFrequency, </ins> os:                         osInterface, oomWatcher:                 oomWatcher, cgroupRoot:                 cgroupRoot,

volumeManager kubeletvolume.VolumeManager // Cloud provider interface. <del> cloud cloudprovider.Interface </del> <ins> cloud                   cloudprovider.Interface autoDetectCloudProvider bool </ins> // Reference to this node. nodeRef *api.ObjectReference

} } else { node.Spec.ExternalID = kl.hostname <del> // If no cloud provider is defined - use the one detected by cadvisor info, err := kl.GetCachedMachineInfo() if err == nil { kl.updateCloudProviderFromMachineInfo(node, info) </del> <ins> if kl.autoDetectCloudProvider { // If no cloud provider is defined - use the one detected by cadvisor info, err := kl.GetCachedMachineInfo() if err == nil { kl.updateCloudProviderFromMachineInfo(node, info) } </ins> } } if err := kl.setNodeStatus(node); err != nil {