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 port forwarding for rkt with kvm stage1 #32126

Merged
merged 1 commit into from
Sep 22, 2016

Conversation

jjlakis
Copy link

@jjlakis jjlakis commented Sep 6, 2016

Port forwarding for rkt kvm using socat.
cc @yifan-gu @euank @pskrzyns @lukasredynk


This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Can a kubernetes member verify that this patch is reasonable to test? If so, please reply "ok to test".

Regular contributors should join the org to skip this step.

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-label-needed labels Sep 6, 2016
@euank
Copy link
Contributor

euank commented Sep 6, 2016

We should also document that there's a slight behavioural difference here in that port-forward only works for applications listening on eth0 within the pod, not eth0 or lo within the pod.

Correct me if I'm wrong ofcourse.

return fmt.Errorf("unable to do port forwarding: nsenter not found.")
var args []string
var fwCaller string
if strings.Contains(r.config.Stage1Image, "kvm") {
Copy link
Contributor

Choose a reason for hiding this comment

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

This won't work in the case that the alpha "stage1 override" annotation is used.

Does the rkt api-service return what stage1 a pod is using? If it doesn't, it probably should.

I'd also slightly prefer checking for a more or less exact match, not just string.Contains for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

@euank api service doesn't return the stage1 info today unfortunately...
@jjlakis To workaround this, we can do something like https://github.com/kubernetes/kubernetes/blob/release-1.4/pkg/kubelet/rkt/rkt.go#L1043-L1053

Copy link
Author

Choose a reason for hiding this comment

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

@yifan-gu As far as I see, I am unable to get pod manifest in this scope. All pod information I got is kubecontainer.pod, or at most manifest from api-service. Am I wrong?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jjlakis manifest from api-service is an marshaled pod manifest. We can unmarshal it into a pod manifest.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jjlakis But we don't need to do that, the pod returned by api service has the annotation. So we can combine the annotation and the runtime.Config to check the stage1 image.

Copy link
Author

Choose a reason for hiding this comment

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

@yifan-gu PTAL. @euank: You're right, where we should document this issue?

@yifan-gu yifan-gu added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels Sep 6, 2016
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 9, 2016

socatPath, lookupErr := exec.LookPath("socat")
if lookupErr != nil {
return fmt.Errorf("unable to do port forwarding: socat not found.")
}

args := []string{"-t", fmt.Sprintf("%d", listResp.Pods[0].Pid), "-n", socatPath, "-", fmt.Sprintf("TCP4:localhost:%d", port)}
// Check in config and in annotations if we're running kvm flavor
isKvm := strings.Contains(r.config.Stage1Image, "kvm")
Copy link
Contributor

Choose a reason for hiding this comment

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

This breaks in the reverse now; if you have stage1-image=kvm and then have the annotation for non-kvm, isKvm still remains true.

Copy link
Author

@jjlakis jjlakis Sep 13, 2016

Choose a reason for hiding this comment

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

@euank I don't see any mistake, there's a loop below overriding isKvm if there's another image in annotations

@jjlakis
Copy link
Author

jjlakis commented Sep 16, 2016

PTAL @pskrzyns

@yifan-gu
Copy link
Contributor

LGTM, leave @pskrzyns for the final review.

@pskrzyns
Copy link

LGTM

We are OK with issue that it will work only for applications listening on eth0.
Full support will be implemented in rktlet.

@yifan-gu yifan-gu added lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-merge labels Sep 20, 2016
@k8s-ci-robot
Copy link
Contributor

Jenkins GCE e2e failed for commit 3a557c6.

The magic incantation to run this job again is @k8s-bot gce e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@yifan-gu
Copy link
Contributor

@k8s-bot test this please , issue #IGNORE

@yifan-gu
Copy link
Contributor

@k8s-bot gce e2e test this

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 5b609f2 into kubernetes:master Sep 22, 2016
@mzylowski mzylowski deleted the kvm_fw branch October 20, 2016 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants