Skip to content

Commit

Permalink
Disable session affinity for internal kuberntes service
Browse files Browse the repository at this point in the history
Under following conditions session affinity leads to a deadlock:
  - Self hosted controller-manager, where it talks to API servers
    via kubernetes service ClusterIP
  - default master-count reconcilier is used
  - --apiserver-count is set to >1 according to the help message
  - number of responsive APIServers goes below `apiserver-count`
  - all controller-managers happen to be hashed to APIServers which
    are down.

What then happens is that controller managers never be able to
contact APIServer, despite correctly working APIServer available.

Less serious outages also possible for other consumers of kubernetes
service, such as operators, kube-dns, flannel & calico, etc.  There is
always non zero chance, that given consumer is hashed  to an apiserver
which is down.

Revert "give the kubernetes service client ip session affinity"
This reverts commit e21ebbc.
  • Loading branch information
redbaron committed Dec 1, 2017
1 parent c933067 commit f2405cf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pkg/master/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (c *Controller) CreateOrUpdateMasterServiceIfNeeded(serviceName string, ser
// maintained by this code, not by the pod selector
Selector: nil,
ClusterIP: serviceIP.String(),
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: serviceType,
},
}
Expand Down
34 changes: 17 additions & 17 deletions pkg/master/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand Down Expand Up @@ -625,7 +625,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -637,7 +637,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -658,7 +658,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -671,7 +671,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -691,7 +691,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -703,7 +703,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -723,7 +723,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -735,7 +735,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -755,7 +755,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -767,7 +767,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -787,7 +787,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -799,7 +799,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -819,7 +819,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeNodePort,
},
},
Expand All @@ -831,7 +831,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand All @@ -851,7 +851,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand Down Expand Up @@ -910,7 +910,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) {
},
Selector: nil,
ClusterIP: "1.2.3.4",
SessionAffinity: api.ServiceAffinityClientIP,
SessionAffinity: api.ServiceAffinityNone,
Type: api.ServiceTypeClusterIP,
},
},
Expand Down

0 comments on commit f2405cf

Please sign in to comment.