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

add proxy-mode:ipvs in service.md #5571

Merged
merged 1 commit into from
Oct 25, 2017
Merged

add proxy-mode:ipvs in service.md #5571

merged 1 commit into from
Oct 25, 2017

Conversation

Lion-Wei
Copy link

@Lion-Wei Lion-Wei commented Sep 21, 2017

This change is Reviewable

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 21, 2017
@k8sio-netlify-preview-bot
Copy link
Collaborator

k8sio-netlify-preview-bot commented Sep 21, 2017

Deploy preview ready!

Built with commit 8ce0c77

https://deploy-preview-5571--kubernetes-io-master-staging.netlify.com

@Lion-Wei
Copy link
Author

cc @m1093782566 , I added some description about ipvs mode, maybe you can help me review this, thanks


In this mode, kube-proxy watches the Kubernetes master for the addition and
removal of `Service` and `Endpoints` objects. For each `Service` it installs
iptables rules which direct requests for TCP/UDP based services to one of the

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/iptables/ipvs

@m1093782566
Copy link

@Lion-Wei

Please ref: kubernetes/community#692, you can do better.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 23, 2017
@Lion-Wei
Copy link
Author

@m1093782566 Thanks, I thought now it's better.

### Proxy-mode: ipvs

In this mode, kube-proxy watches Kubernetes `services` and `endpoints`,
call `netlink` interface create ipvs `virtual server` and `real server` accordingly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and it creates IPVS "virtual server" and "real server" accordingly.

  • a reader doesn't care the fact that netlink interface exists and gets called;
  • virtual server and real server are not supposed to be verbatim.

table as the underlying data structure and work in the kernal state.
That means ipvs redirects traffic can be much faster, and have much
better performance when sync proxy rules. Furthermore, ipvs provides more
options for load balancing algorithm, such as:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the grammar errors.

@m1093782566
Copy link

m1093782566 commented Sep 26, 2017

Self /assign @m1093782566 for technical review.

consistent with the expectation. When access the `service`, traffic will
be redirect to one of the backend `pod`.

Ipvs based on netfilter hook function, like iptables proxy, but use hash

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to iptables, IPVS is based on netfilter...

**Note:** ipvs mode assumed IPVS kernel modules are installed on the node
before running kube-proxy. When kube-proxy starts, if proxy mode is ipvs,
kube-proxy would validate if IPVS modules are installed on the node, if
it's not installed kube-proxy will fall back to userspace proxy mode.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userspace -> iptables

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ipvs.CanUseIPVSProxier will return (false, error) if ipvs modules are not installed. so kube-proxy will fall back to userspace proxy mode.

I am not sure if I am missing something. @m1093782566 @dujun1990

func tryIPVSProxy(iptver iptables.IPTablesVersioner, kcompat iptables.KernelCompatTester) string {
	// guaranteed false on error, error only necessary for debugging
	// IPVS Proxier relies on iptables
	useIPVSProxy, err := ipvs.CanUseIPVSProxier()
	if err != nil {
		utilruntime.HandleError(fmt.Errorf("can't determine whether to use ipvs proxy, using userspace proxier: %v", err))
		return proxyModeUserspace
	}
	if useIPVSProxy {
		return proxyModeIPVS
	}

	// TODO: Check ipvs version

	// Try to fallback to iptables before falling back to userspace
	glog.V(1).Infof("Can't use ipvs proxier, trying iptables proxier")
	return tryIPTablesProxy(iptver, kcompat)
}

Copy link

@m1093782566 m1093782566 Oct 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, that's not intended - I assume it's a bug. See bug fix in kubernetes/kubernetes#54120. FYI

@@ -203,6 +203,35 @@ having working [readiness probes](/docs/tasks/configure-pod-container/configure-

![Services overview diagram for iptables proxy](/images/docs/services-iptables-overview.svg)

### Proxy-mode: ipvs
Copy link
Member

@caseydavenport caseydavenport Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should say [alpha] and/or have some sort of note in bold letters at the top that this is an alpha feature and not recommended for production clusters yet.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member

@caseydavenport caseydavenport left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to note that this is an alpha feature, and list any limitations.

@chenopis
Copy link
Contributor

chenopis commented Sep 26, 2017

FYI, you can use the call out formatting for the note: https://kubernetes.io/docs/home/contribute/style-guide/#callout-formatting

@m1093782566
Copy link

I think this needs to note that this is an alpha feature, and list any limitations.

+1

@steveperry-53
Copy link
Contributor

Ping @Lion-Wei. It looks like this is very close to being ready.

@zhangxiaoyu-zidif
Copy link
Contributor

ping @Lion-Wei

@Lion-Wei
Copy link
Author

@m1093782566 @chenopis @caseydavenport , thank you all, sorry did't fix this in time.

@steveperry-53
Copy link
Contributor

@Lion-Wei @m1093782566 @tengqm @carlory @caseydavenport Is this ready to merge? If so, can one of you give tech approval? Thanks.

@Lion-Wei
Copy link
Author

/cc @m1093782566 @carlory @caseydavenport @steveperry-53 , slightly cc. : )

@heckj heckj merged commit 3e90bbd into kubernetes:master Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.