Commit Graph

159 Commits (47b4c0e7706a9ddd84e9636cc3a7c5d802f93069)

Author SHA1 Message Date
Kubernetes Submit Queue 9c5bf904c2 Merge pull request #32217 from freehan/kubenetcheck
Automatic merge from submit-queue

nit fixes

Do not merge yet. Wait till it gets bigger. 

fix included:
1. use golang native util to list dir
2016-09-24 03:28:28 -07:00
Yifan Gu 5389a74388 kubenet: SyncHostports for both running and ready to run pods.
This fixes the race that happens in rktnetes when pod B invokes
'kubenet.SetUpPod()' before another pod A becomes actually running.

The second 'kubenet.SetUpPod()' call will not pick up the pod A
and thus overwrite the host port iptable rules that breaks pod A.

This PR fixes the case by listing all 'active pods' (all non-exited
pods) instead of only running pods.
2016-09-16 17:29:44 -07:00
Kubernetes Submit Queue c4893df894 Merge pull request #32151 from bboreham/fix-cni-on-gci
Automatic merge from submit-queue

Add flag to set CNI bin dir, and use it on gci nodes

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

When using `kube-up` on GCE, following #31023 which moved the workers from debian to gci, CNI just isn't working.  The root cause is basically as discussed in #28563: one flag (`--network-plugin-dir`) means two different things, and the `configure-helper` script uses it for the wrong purpose.

This PR adds a new flag `--cni-bin-dir`, then uses it to configure CNI as desired.

As discussed at #28563, I have also added a flag `--cni-conf-dir` so users can be explicit 

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

**Special notes for your reviewer**:

I left the old flag largely alone for backwards-compatibility, with the exception that I stop setting the default when CNI is in use.  The value of `"/usr/libexec/kubernetes/kubelet-plugins/net/exec/"` is unlikely to be what is wanted there.

**Release note**:
```release-note
Added new kubelet flags `--cni-bin-dir` and `--cni-conf-dir` to specify where CNI files are located.
Fixed CNI configuration on GCI platform when using CNI.
```
2016-09-13 16:42:06 -07:00
Bryan Boreham db5fa5297d Fix unit tests and known flags list 2016-09-13 20:42:52 +00:00
Kubernetes Submit Queue 6538912013 Merge pull request #31322 from feiskyer/killpod
Automatic merge from submit-queue

Kubelet: add KillPod for new runtime API

This PR adds implements of KillPod for new runtime API.

CC @yujuhong @Random-Liu @kubernetes/sig-node @kubernetes/sig-rktnetes
2016-09-10 03:10:32 -07:00
Minhan Xia 118ebd57aa fix a bug in hostport where it flushes KUBE-MARK-MASQ chain 2016-09-09 14:39:47 -07:00
Bryan Boreham a2e583a86c Move default directory for exec plugin into exec plugin 2016-09-09 11:43:16 +01:00
Bryan Boreham 4e961e2bf5 Add options to set CNI config and binary directories
Also make clearer the function of --network-plugin-dir when using CNI
2016-09-09 11:43:16 +01:00
Pengfei Ni 277070e267 Kubelet: add KillPod for new runtime API 2016-09-08 20:56:50 +08:00
Minhan Xia 8031c8d97b use golang native util to list dir 2016-09-07 10:42:27 -07:00
Kubernetes Submit Queue 2a7d0df30d Merge pull request #30727 from asalkeld/iptables-caps
Automatic merge from submit-queue

Clean up IPTables caps i.e.: sed -i "s/Iptables/IPTables/g"

Fixes #30651
2016-09-06 09:01:27 -07:00
Kubernetes Submit Queue 1e21eda604 Merge pull request #31197 from freehan/kubenethairpin
Automatic merge from submit-queue

Deprecate the old cbr0 and flannel networking modes

fixes: #19766
2016-09-02 18:51:05 -07:00
Minhan Xia fd4c947de9 correct typo in kubenet config 2016-09-02 14:33:34 -07:00
Minhan Xia 20ed879faa kubenet checks required cni plugins are present 2016-09-01 17:16:05 -07:00
Angus Salkeld f785f3d3ef Clean up IPTables caps i.e.: sed -i "s/Iptables/IPTables/g" 2016-08-29 10:34:42 +10:00
Kubernetes Submit Queue d3ecad111e Merge pull request #28717 from freehan/ebtable
Automatic merge from submit-queue

Filter duplicate network packets in promiscuous bridge mode (with ebtables)

also fixes: #30783
2016-08-25 19:12:09 -07:00
Minhan Xia c1d3c89cfa fix #30376 that broken cross-build 2016-08-24 13:18:18 -07:00
Minhan Xia 42a554ec0d add ebtables rules to filter duplicate packets 2016-08-24 10:19:29 -07:00
Minhan Xia 950e689637 kubenet set cbr0 mac address 2016-08-24 10:18:48 -07:00
Justin Santa Barbara 902ba4e249 Add network-plugin-mtu option for MTU selection
MTU selection is difficult, and if there is a transport such as IPSEC in
use may be impossible.  So we allow specification of the MTU with the
network-plugin-mtu flag, and we pass this down into the network
provider.

Currently implemented by kubenet.
2016-08-23 01:50:58 -04:00
Justin Santa Barbara 2c103af2b6 Create testable implementation of sysctl
This is so we can test kubenet Init, which calls sysctl
2016-08-23 01:42:37 -04:00
Wojciech Tyczynski 0459574450 Revert "Use netlink.SetPromiscOn instead of iproute2 command" 2016-08-22 10:28:11 +02:00
Kubernetes Submit Queue ada5669c7f Merge pull request #30346 from dshulyak/promisc
Automatic merge from submit-queue

Use netlink.SetPromiscOn instead of iproute2 command

Depends on https://github.com/vishvananda/netlink/pull/157
Related https://github.com/kubernetes/kubernetes/issues/26093
2016-08-21 23:34:21 -07:00
Minhan Xia 85b2f9047a update godep to pull from containernetworking/cni 2016-08-19 13:31:50 -07:00
Dmitry Shulyak b79a12c7ce Use netlink.SetPromiscOn instead of iproute2 command 2016-08-14 14:58:14 +03:00
Minhan Xia 7964148059 move syncNetworkConfig to Init for cni network plugin 2016-08-12 16:49:25 -07:00
k8s-merge-robot 63602348a4 Merge pull request #29009 from bboreham/hairpin-via-cni
Automatic merge from submit-queue

Use the CNI bridge plugin to set hairpin mode

Following up this part of #23711:

>  I'd like to wait until containernetworking/cni#175 lands and then just pass the request through to CNI.

The code here just
 * passes the required setting down from kubenet to CNI
 * disables `DockerManager` from doing hairpin-veth, if kubenet is in use

Note to test you need a very recent version of the CNI `bridge` plugin; the one brought in by #28799 should be OK.

Also relates to https://github.com/kubernetes/kubernetes/issues/19766#issuecomment-232722864
2016-07-31 10:08:06 -07:00
Mike Danese 792868c743 periodically reload the cni plugin config
Signed-off-by: Mike Danese <mikedanese@google.com>
2016-07-27 10:07:52 -07:00
Euan Kemp 6aed2a0b1d network/cni: Search `vendorDir` for lo plugin too
Though frankly the vendor dir thing should probably be removed in a
followup PR.
2016-07-22 14:40:44 -07:00
Euan Kemp 8f7b5bcfd3 network/cni: Always setup 'lo'
See issue #28561
2016-07-22 14:40:35 -07:00
Bryan Boreham 26a53fcd47 Use the CNI bridge plugin to set hairpin mode
Pass the flag down in kubenet, and disable it in DockerManager
2016-07-14 17:52:51 +01:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
k8s-merge-robot 8ed6c8eeb8 Merge pull request #27914 from yifan-gu/fix_kubenet_hostport
Automatic merge from submit-queue

kubenet: Fix host port for rktnetes.

Because rkt pod runs after plugin.SetUpPod() is called, so
getRunningPods() does not return the newly created pod, which
causes the hostport iptable rules to be missing for this new pod.

cc @dcbw @freehan 

A follow up fix for https://github.com/kubernetes/kubernetes/pull/27878#issuecomment-227898936
2016-06-23 18:48:45 -07:00
Yifan Gu 9140ce07bc kubenet: Fix host port for rktnetes.
Because rkt pod runs after plugin.SetUpPod() is called, so
getRunningPods() does not return the newly created pod, which
causes the hostport iptable rules to be missing for this new pod.
2016-06-23 13:17:01 -07:00
Minhan Xia 48169ce736 avoid deleting cbr0 address due to subnet string mismatch 2016-06-22 16:45:04 -07:00
Dan Williams e47d020cb6 kubelet/kubenet: simplify getting nsenter path 2016-06-22 14:26:11 -05:00
Dan Williams a657d0587b kubelet/kubenet: Fix getRunningPods() to support rkt pods
Don't assume there's an infra container.
2016-06-22 13:45:13 -05:00
Dan Williams db078dbea4 kubelet/cni/kubenet: use common container IP address functions 2016-06-22 11:36:10 -05:00
Dan Williams 9865ac325c kubelet/cni: make cni plugin runtime agnostic
Use the generic runtime method to get the netns path.  Also
move reading the container IP address into cni (based off kubenet)
instead of having it in the Docker manager code.  Both old and new
methods use nsenter and /sbin/ip and should be functionally
equivalent.
2016-06-22 11:36:10 -05:00
Dan Williams a519e8a403 kubenet: clean up networking when setup errors occur
Relying on the runtime to later call cleanup is fragile, so make sure
that everything gets nicely cleaned up when setup errors occur.
2016-06-16 13:53:28 -05:00
Dan Williams 965492fdd0 kubelet/kubenet: split hostport handling into separate module 2016-06-16 13:44:32 -05:00
k8s-merge-robot 64da66bab4 Merge pull request #24983 from Arvinderpal/cni_args_ignoreunknown
Automatic merge from submit-queue

Sets IgnoreUnknown=1 in CNI_ARGS

```release-note
release-note-none
```

K8 uses CNI_ARGS to pass pod namespace, name and infra container
id to the CNI network plugin. CNI logic will throw an error
if these args are not known to it, unless the user specifies
IgnoreUnknown as part of CNI_ARGS. This PR sets IgnoreUnknown=1
to prevent the CNI logic from erroring and blocking pod setup.
https://github.com/appc/cni/pull/158
https://github.com/appc/cni/issues/126
2016-06-11 05:38:30 -07:00
k8s-merge-robot 805a0aae71 Merge pull request #27141 from freehan/hpfix
Automatic merge from submit-queue

only handled non host network pods for hostports in kubenet

attempt to fix: #27118
2016-06-09 22:08:10 -07:00
Minhan Xia 1276a91638 kubenet masqurade for outbound traffic 2016-06-09 18:43:34 -07:00
Minhan Xia 1b2386f1ce only handled non host network pods for hostports in kubenet 2016-06-09 11:32:16 -07:00
Minhan Xia e9f8c70eaf pass NetworkPluginDir to kubenet 2016-06-03 10:22:49 -07:00
k8s-merge-robot 98af443209 Merge pull request #26398 from euank/various-kubenet-fixes
Automatic merge from submit-queue

Various kubenet fixes (panics and bugs and cidrs, oh my)

This PR fixes the following issues:

1. Corrects an inverse error-check that prevented `shaper.Reset` from ever being called with a correct ip address
2. Fix an issue where `parseCIDR` would fail after a kubelet restart due to an IP being stored instead of a CIDR being stored in the cache.
3. Fix an issue where kubenet could panic in TearDownPod if it was called before SetUpPod (e.g. after a kubelet restart).. because of bug number 1, this didn't happen except in rare situations (see 2 for why such a rare situation might happen)

This adds a test, but more would definitely be useful.
The commits are also granular enough I could split this up more if desired.

I'm also not super-familiar with this code, so review and feedback would be welcome.

Testing done:
```
$ cat examples/egress/egress.yml
 apiVersion: v1
kind: Pod
metadata:
  labels:
    name: egress
  name: egress-output
  annotations: {"kubernetes.io/ingress-bandwidth": "300k"}
spec:
  restartPolicy: Never
  containers:
    - name: egress
      image: busybox
      command: ["sh", "-c", "sleep 60"]
$ cat kubelet.log
...
Running: tc filter add dev cbr0 protocol ip parent 1:0 prio 1 u32 match ip dst 10.0.0.5/32 flowid 1:1
# setup
...
Running: tc filter del dev cbr0 parent 1:proto ip prio 1 handle 800::800 u32
# teardown
```

I also did various other bits of manual testing and logging to hunt down the panic and other issues, but don't have anything to paste for that 

cc @dcbw @kubernetes/sig-network
2016-05-29 04:04:22 -07:00
k8s-merge-robot 350efaf13d Merge pull request #26096 from euank/set-pod-ip
Automatic merge from submit-queue

rkt: Pass through podIP

This is needed for the /etc/hosts mount and the downward API to work.
Furthermore, this is required for the reported `PodStatus` to be
correct.

The `Status` bit mostly worked prior to #25062, and this restores that
functionality in addition to the new functionality.

In retrospect, the regression in status is large enough the prior PR should have included at least some of this; my bad for not realizing the full implications there.

#25902 is needed for downwards api stuff, but either merge order is fine as neither will break badly by itself.

cc @yifan-gu @dcbw
2016-05-28 12:40:39 -07:00
Euan Kemp c83ad19ae9 kubenet: Fix ipv4 validity check
The length of an IP can be 4 or 16, and even if 16 it can be a valid
ipv4 address. This check is the more-correct way to handle this, and it
also provides more granular error messages.
2016-05-27 16:25:14 -07:00
Euan Kemp 93487867ac kubenet: Update empty ip check
The previous check was incorrect because the `IP.String` method returns
`<nil>` and other non-empty-strings on error conditions.
2016-05-27 10:47:13 -07:00