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

Enable iptables -w in kubeadm selfhosted #46372

Merged

Conversation

cmluciano
Copy link

Currently containerized kube-proxy cannot support iptables -w
unless the xtables.lock is mounted.

Related: #46103

Signed-off-by: Christopher M. Luciano cmluciano@us.ibm.com

Special notes for your reviewer:

  • I need to figure out how to do some pre-setup to touch the file if it does not exist.
    Release note:
support iptables -w in kubeadm containerized kube-proxy

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 24, 2017
@k8s-github-robot k8s-github-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels May 24, 2017
@cmluciano
Copy link
Author

cc @bboreham @dcbw

@justinsb
Copy link
Member

I approve, but it's only a soft approve as I don't know this code very well :-)

One option to skip the file-already-exists problem is to mount /run, which I believe we can assume is always there?

@cmluciano
Copy link
Author

Thanks @justinsb . I did not go with this option initially since @bboreham mentioned that it would probably introduce other bugs #46103 (comment).

Copy link
Member

@luxas luxas left a comment

Choose a reason for hiding this comment

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

Have you tested that this fixes the issue?

Basically LGTM

@@ -87,6 +90,9 @@ spec:
- name: kube-proxy
configMap:
name: kube-proxy
- name: xtables-lock
hostpath:
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be hostPath

@luxas luxas self-assigned this May 30, 2017
@luxas
Copy link
Member

luxas commented May 30, 2017

I'm deferring to @bboreham on this one as he's the author of the linked issue

@bboreham
Copy link
Contributor

This part is still open:

I need to figure out how to do some pre-setup to touch the file if it does not exist.

AFAIK this would be somewhere like /etc/systemd/system/kubelet.service.d/10-kubeadm.conf, which I think gets delivered by the package(s). And I have no idea where they live.

@cmluciano
Copy link
Author

@luxas Any pointers on where I would do the touch for making sure that the file exists?

@cmluciano
Copy link
Author

I can't filter through the log files

@k8s-bot pull-kubernetes-unit test this

@0xmichalis 0xmichalis added this to the v1.7 milestone Jun 3, 2017
@0xmichalis
Copy link
Contributor

@k8s-bot pull-kubernetes-e2e-kops-aws test this

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 5, 2017
@@ -64,6 +64,16 @@ spec:
labels:
k8s-app: kube-proxy
spec:
initContainers:
- name: touch-lock
image: busybox
Copy link
Member

Choose a reason for hiding this comment

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

Must be an image that's compatible with all architectures

Copy link
Author

Choose a reason for hiding this comment

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

May be related #46820

Copy link
Author

Choose a reason for hiding this comment

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

@luxas Do we have some examples of a generic cross ARCH image?

Copy link
Member

Choose a reason for hiding this comment

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

@ixdy ^

I think we have a gcr.io image of it somewhere. The hard question is security updates for that one @timstclair

Choose a reason for hiding this comment

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

The image needs to be templated to be cross arch. For this type of simple command, we usually just use busybox (though I'd like to switch to alpine). E.g.

ifeq ($(ARCH),amd64)

@@ -87,6 +100,9 @@ spec:
- name: kube-proxy
configMap:
name: kube-proxy
- name: xtables-lock
hostPath:
path: /run/xtables.lock
Copy link
Member

Choose a reason for hiding this comment

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

Is this a file or directory? I suppose file. Will k8s always mount it as a file as well?

- name: touch-lock
image: busybox
command: ['/bin/touch', '/run/xtables.lock']
securityContext:
Copy link
Member

Choose a reason for hiding this comment

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

Should this be for pod or init container?

Copy link
Author

Choose a reason for hiding this comment

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

Good point, it should probably just be put at the pod level

command: ['/bin/touch', '/run/xtables.lock']
securityContext:
privileged: true
volumeMounts:
Copy link
Member

Choose a reason for hiding this comment

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

Meant for the init container, right?

Copy link
Author

Choose a reason for hiding this comment

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

yes, the run mount is only for the init container

privileged: true
volumeMounts:
- mountPath: /run
name: run
Copy link
Member

Choose a reason for hiding this comment

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

I don't see any run volume

Copy link
Author

Choose a reason for hiding this comment

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

added

@cmluciano
Copy link
Author

This seems relevant certificates.go:48] Failed to start certificate controller: open /etc/kubernetes/ca/ca.pem: no such file or directory . I'm wondering if this needs to be mounted into the kube-proxy container.

Copy link
Member

@luxas luxas left a comment

Choose a reason for hiding this comment

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

LGTM for everything but the busybox constant.

@marun marun added the sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. label Jun 8, 2017
@cmluciano
Copy link
Author

xref: #47212

@@ -64,6 +64,14 @@ spec:
labels:
k8s-app: kube-proxy
spec:
initContainers:
- name: touch-lock
image: {{ .ImageRepository }}/busybox-{{ .Arch }}
Copy link
Author

Choose a reason for hiding this comment

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

@timstclair @luxas does this look better?

Copy link
Member

Choose a reason for hiding this comment

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

@ixdy We'd have to push an gcr.io/google_containers/busybox-${ARCH} image then (totally possible), don't know if that's feasible from a security standpoint (we'd have to keep it up to date)

cc @timstclair @thockin Please chime in with your thoughts here...

Copy link
Author

Choose a reason for hiding this comment

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

While it would be great to get this merged, I'm inclined to await #46597 to land and then I can remove the init container.

Copy link
Member

Choose a reason for hiding this comment

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

@cmluciano How critical is this? Can we afford not having this in v1.7?
Where is the related bug/issue?

Copy link
Author

Choose a reason for hiding this comment

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

If kube-proxy is containerized, I believe that it will not properly function. cc @bboreham for confirmation

Copy link
Member

Choose a reason for hiding this comment

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

If it doesn't work at all, it's a release blocker

Choose a reason for hiding this comment

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

We should use the upstream busybox images. gcr.io/google-containers won't be kept up to date.

Copy link
Member

Choose a reason for hiding this comment

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

@cmluciano Actually you can use upstream images, but that will add more logic. In this case it seems like the only approach.
So add {{ .BusyboxImage }} or similar and set it conditionally:

 GOARCH Image
amd64 busybox
 arm  armhf/busybox
arm64  aarch64/busybox
 ppc64le  ppc64le/busybox
 s390x s390x/busybox 

Copy link
Author

Choose a reason for hiding this comment

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

Let me test with #47212 quick and see if that will work as an interim

@cmluciano
Copy link
Author

/retest

job is marked as flaky

@luxas
Copy link
Member

luxas commented Jun 13, 2017

#47212 would be the better solution yeah

Currently containerized kube-proxy cannot support iptables -w
unless the xtables.lock is mounted.

Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>
@cmluciano
Copy link
Author

cmluciano commented Jun 13, 2017

Ok all tests are passing now @luxas. I am going to push up a TODO on this line to rebase on #46597 when it is merged and I opened kubernetes/kubeadm#298 to track it.

@cmluciano
Copy link
Author

/retest

seems like a cleanup issue

@luxas luxas changed the title WIP: Enable iptables -w in kubeadm selfhosted Enable iptables -w in kubeadm selfhosted Jun 13, 2017
@luxas
Copy link
Member

luxas commented Jun 13, 2017

cc @dchen1107 @yujuhong @MrHohn @freehan FYI
Implementation of #47212 for kubeadm.

This is a bug fix for v1.7

@luxas luxas added the kind/bug Categorizes issue or PR as related to a bug. label Jun 13, 2017
@luxas
Copy link
Member

luxas commented Jun 13, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cmluciano, luxas

Associated issue: 46103

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 13, 2017
@luxas
Copy link
Member

luxas commented Jun 13, 2017

/retest

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 47084, 46016, 46372)

@k8s-github-robot k8s-github-robot merged commit 0a1b7d9 into kubernetes:master Jun 13, 2017
luxas added a commit to luxas/kubernetes that referenced this pull request Jun 15, 2017
k8s-github-robot pushed a commit that referenced this pull request Jun 16, 2017
Automatic merge from submit-queue (batch tested with PRs 47451, 47410, 47598, 47616, 47473)

kubeadm: Fix kube-proxy regression caused by #46372

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

Fixes: kubernetes/kubeadm#306

**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**:

Required for kubeadm v1.7 to work

**Release note**:

```release-note
NONE
```
@kubernetes/sig-cluster-lifecycle-pr-reviews @cmluciano
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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants