Skip to content

Commit

Permalink
Merge pull request kubernetes#51937 from Lion-Wei/ipvs-readme
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue. 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>..

add readme file of ipvs

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

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:
```
None
```
  • Loading branch information
Kubernetes Submit Queue authored Sep 23, 2017
2 parents 7054b5b + 2537268 commit 976efef
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions pkg/proxy/ipvs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# How to use IPVS

This document shows how to use kube-proxy ipvs mode.

### What is IPVS

**IPVS (IP Virtual Server)** implements transport-layer load balancing, usually called Layer 4 LAN switching, as part of
Linux kernel.

IPVS 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 real servers appear as irtual services on a single IP address.

### How to use

##### Load IPVS kernel modules

Currently the IPVS kernel module can't be loaded automatically, so first we should use the following command to load IPVS kernel
modules manually.

```shell
modprobe ip_vs
modprobe ip_vs_rr
modprobe ip_vs_wrr
modprobe ip_vs_sh
modprobe nf_conntrack_ipv4
```

After that, use `lsmod | grep ip_vs` to make sure kernel modules are loaded.

##### Run kube-proxy in ipvs mode

First, [run cluster locally](https://github.com/kubernetes/community/blob/master/contributors/devel/running-locally.md).

By default kube-proxy will run in iptables mode, with configuration file `/tmp/kube-proxy.yaml`. so we need to change the
configuration file and restart it. Here is a yaml file for reference.

```yaml
apiVersion: componentconfig/v1alpha1
kind: KubeProxyConfiguration
clientConnection:
kubeconfig: /var/run/kubernetes/kube-proxy.kubeconfig
hostnameOverride: 127.0.0.1
mode: ipvs
featureGates: AllAlpha=true
ipvs:
minSyncPeriod: 10s
syncPeriod: 60s
```
##### Test
Use `ipvsadm` tool to test whether the kube-proxy start succeed. By default we may get result like:

```shell
# ipvsadm -ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 10.0.0.1:443 rr persistent 10800
-> 10.229.43.2:6443 Masq 1 0 0
TCP 10.0.0.10:53 rr
UDP 10.0.0.10:53 rr
```

0 comments on commit 976efef

Please sign in to comment.