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

Adding IPVS blog post #9431

Merged
merged 3 commits into from
Jul 9, 2018
Merged

Adding IPVS blog post #9431

merged 3 commits into from
Jul 9, 2018

Conversation

kbarnard10
Copy link
Contributor

For 5 Days of K8s series.

/assign @natekartchner

@k8s-ci-robot k8s-ci-robot added 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. labels Jul 9, 2018
@k8sio-netlify-preview-bot
Copy link
Collaborator

k8sio-netlify-preview-bot commented Jul 9, 2018

Deploy preview for kubernetes-io-master-staging ready!

Built with commit e6586d7

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

@k8sio-netlify-preview-bot
Copy link
Collaborator

Deploy preview for kubernetes-io-master-staging ready!

Built with commit 19470a1

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

@kbarnard10
Copy link
Contributor Author

/assign @zacharysarah

Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

thanks you, for this blog post @kbarnard10 and the other authors! 👍 💯


**Parameter: --ipvs-min-sync-period** Minimum interval of how often the IPVS rules are refreshed (e.g. '5s', '1m'). Must be greater than 0.

**Parameter: --ipvs-exclude-cidrs** A comma-separated list of CIDR's which the IPVS proxier should not touch when cleaning up IPVS rules because IPVS proxier can't distinguish kube-proxy created ipvs rules from user original ipvs rules. If you are using IPVS proxier with your own IPVS rules in the environment, this parameter should be specified, otherwise your original rule will be cleaned.
Copy link
Member

Choose a reason for hiding this comment

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

uppercase ipvs -> IPVS.

distinguish kube-proxy created IPVS rules from user original IPVS rules.

Copy link
Member

Choose a reason for hiding this comment

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

possibly style --ipvs-exclude-cidrs, --ipvs-min-sync-period, --ipvs-sync-period with " ` "
even if they are in bold text?


**IPVS** (**IP Virtual Server**) is built on top of the Netfilter and implements transport-layer load balancing as part of the Linux kernel.

IPVS is incorporated into the LVS(Linux Virtual Server), where it runs on a host and acts as a load balancer in front of a cluster of real servers. IPVS can direct requests for TCP- and UDP-based services to the real servers, and make services of the real servers appear as virtual services on a single IP address. Therefore, IPVS naturally supports Kubernetes Service.
Copy link
Member

Choose a reason for hiding this comment

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

add space before bracket:
LVS(Linux Virtual Server) -> LVS (Linux Virtual Server)


Even though Kubernetes already support 5000 nodes in release v1.6, the kube-proxy with iptables is actually a bottleneck to scale the cluster to 5000 nodes. One example is that with NodePort Service in a 5000-node cluster, if we have 2000 services and each services have 10 pods, this will cause at least 20000 iptable records on each worker node, and this can make the kernel pretty busy.

On the other hand, using IPVS-based in-cluster service load balancing can help a lot for such cases. IPVS is specifically designed for load balancing and uses more efficient data structures(hash tables) allowing for almost unlimited scale under the hood.
Copy link
Member

Choose a reason for hiding this comment

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

space before (hash tables).


### Parameter Changes

**Parameter: --proxy-mode** In addition to existing userspace and iptables modes, IPVS mode is configured via `--proxy-mode=ipvs`. It implicitly uses IPVS NAT mode for Service port mapping.
Copy link
Member

Choose a reason for hiding this comment

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

possibly lowercase service?


**Parameter: --ipvs-scheduler**

A new kube-proxy parameter will be added to specify the IPVS load balancing algorithm, with the parameter being `--ipvs-scheduler`. If it’s not configured, then round-robin (rr) is the default value.
Copy link
Member

Choose a reason for hiding this comment

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

re: will be added
--ipvs-scheduler was fist added in v1.8.0-beta.0,
while the scheduler methods were introduced around v1.9.0-alpha.2, if i'm not mistaken.

perhaps reword the sentence to use paste tense?


When creating a ClusterIP type Service, IPVS proxier will do the following three things:

* Make sure a dummy interface exists in the node, default to kube-ipvs0
Copy link
Member

Choose a reason for hiding this comment

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

, default to ->, defaults to ?

-> 10.244.1.237:8080 Masq 1 0 0
```

Please note that the relationship between a Kubernetes Service and IPVS virtual servers is `1:N`. Consider a Kubernetes Service that has more than one IP addresses, for example, an External IP type Service has two IP addresses(ClusterIP and External IP). Then the IPVS proxier will create 2 IPVS virtual servers - one for Cluster IP and another one for External IP. The relationship between a Kubernetes Endpoint(each IP+Port pair) and an IPVS virtual server is `1:1`.
Copy link
Member

Choose a reason for hiding this comment

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

spaces before (each IP+Port pair) and (ClusterIP and External IP).

i would reword:

Consider a Kubernetes Service that has more than one IP addresses, for example, an External IP type Service has two IP addresses(ClusterIP and External IP).

to:

For example, consider a Kubernetes Service that has more than one IP address. An External IP type Service has two IP addresses - ClusterIP and External IP.


#### Port Mapping

There are three proxy modes in IPVS: NAT (masq), IPIP and DR. Only NAT mode supports port mapping. Kube-proxy leverages NAT mode for port mapping. The following example shows IPVS mapping Service port 3080 to Pod port 8080.
Copy link
Member

Choose a reason for hiding this comment

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

there is an extra space before mapping and 3080.


#### Iptables & Ipset in IPVS Proxier

IPVS is for load balancing, it can't handle other workarounds in kube-proxy, e.g. packet filtering, hairpin-masquerade tricks, SNAT, etc.
Copy link
Member

Choose a reason for hiding this comment

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

, it can't -> and it can't


### Run kube-proxy in IPVS Mode

Currently, local-up scripts, GCE scripts, and kubeadm support switching IPVS proxy mode via exporting environment variables(`KUBE_PROXY_MODE=ipvs`) or specifying flag(`--proxy-mode=ipvs`). Before running IPVS proxier, please ensure IPVS required kernel modules are already installed.
Copy link
Member

Choose a reason for hiding this comment

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

spaces before (.

@kbarnard10
Copy link
Contributor Author

@neolit123 Thanks! Edits made.

@zacharysarah
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 9, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zacharysarah

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 9, 2018
@k8s-ci-robot k8s-ci-robot merged commit 22f5f71 into kubernetes:master Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

6 participants