Merge pull request #54120 from m1093782566/fix-proxy-mode

Automatic merge from submit-queue (batch tested with PRs 54906, 54120, 54934, 54915, 54848). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix kube-proxy fall back to iptables firstly when unable to load kernel modules

**What this PR does / why we need it**:

Fix kube-proxy fall back to iptables firstly when unable to load kernel modules

**Which issue this PR fixes**: 

fixes #54121

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/kind bug
/sig network
/area kube-proxy
This commit is contained in:
Kubernetes Submit Queue 2017-11-02 23:02:10 -07:00 committed by GitHub
commit b006bc5d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -275,8 +275,8 @@ func tryIPVSProxy(iptver iptables.IPTablesVersioner, kcompat iptables.KernelComp
// IPVS Proxier relies on iptables // IPVS Proxier relies on iptables
useIPVSProxy, err := ipvs.CanUseIPVSProxier() useIPVSProxy, err := ipvs.CanUseIPVSProxier()
if err != nil { if err != nil {
utilruntime.HandleError(fmt.Errorf("can't determine whether to use ipvs proxy, using userspace proxier: %v", err)) // Try to fallback to iptables before falling back to userspace
return proxyModeUserspace utilruntime.HandleError(fmt.Errorf("can't determine whether to use ipvs proxy, error: %v", err))
} }
if useIPVSProxy { if useIPVSProxy {
return proxyModeIPVS return proxyModeIPVS