Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service sessionAffinity with ClientIP 180 sec instead of minutes when using iptables proxy mode. #35677

Closed
vincentheet opened this issue Oct 27, 2016 · 0 comments · Fixed by #35681

Comments

@vincentheet
Copy link
Contributor

vincentheet commented Oct 27, 2016

Kubernetes version: 1.4.4

Environment:

  • Cloud provider or hardware configuration: GKE
  • Kernel: Linux gke-pool 3.16.0-4-amd64 1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux

What happened: Session affinity is lost frequently when using a service to connect from a pod to another pod using a service with sessionAffinity: ClientIP on Kubernetes 1.4.4 with the iptables proxy mode.

What you expected to happen: Adhere to sessionAffinity: ClientIP setting and do not open/route connections to other endpoints off the service for this ClientIP.

How to reproduce it: Make a service with sessionAffinity set to ClientIP.

apiVersion: v1
kind: Service
metadata:
  labels:
    name: galera-saf-cli
  name: galera-saf-cli
spec:
  ports:
    - port: 3306
      targetPort: 3306
  selector:
    type: galera
  sessionAffinity: ClientIP

Anything else do we need to know:
It seems like the stickyMaxAgeMinutes is refactored to stickyMaxAgeSeconds in this commit: 8e503f3

Where previously stickyMaxAgeMinutes was indeed incorrect since the setting was seconds there was a multiply of 60 to convert the property from seconds to minutes info.stickyMaxAgeMinutes*60 on this line: 731d5e5#diff-d51765b83fe795b469e8a86276b12dc9L513

In my opinion the behaviour should be that the stickiness is retained for 180 minutes instead of 180 seconds. The affinity is also 180 minutes in the kube-proxy implementation:

stickyMaxAgeMinutes: 180, // TODO: parameterize this in the API.

vincentheet added a commit to vincentheet/kubernetes that referenced this issue Oct 27, 2016
k8s-github-robot pushed a commit that referenced this issue Nov 22, 2016
Automatic merge from submit-queue

Change stickyMaxAge from seconds to minutes, fixes issue #35677

**What this PR does / why we need it**: Increases the service sessionAfinity time from 180 seconds to 180 minutes for proxy mode iptables which was a bug introduced in a refactor.

**Which issue this PR fixes**: fixes #35677

**Special notes for your reviewer**: 

**Release note**:

``` release-note
Fixed wrong service sessionAffinity stickiness time from 180 sec to 180 minutes in proxy mode iptables.
```

Since there is no test for the sessionAffinity feature at the moment I wanted to create one but I don't know how.
kshafiee pushed a commit to kshafiee/kubernetes that referenced this issue Dec 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants