kubernetes-up-and-running / kuard

Demo app for Kubernetes Up and Running book
Apache License 2.0
1.56k stars 535 forks source link

Documentation: Add socat as a pre-requisite #17

Open Matty9191 opened 6 years ago

Matty9191 commented 6 years ago

Hello folks,

Loved the book and have found kuard super useful for testing. I bumped into an issue this morning when I tried to create a port-forward to kuard:

$ kubectl port-forward kuard 8080:8080 Forwarding from 127.0.0.1:8080 -> 8080 Handling connection for 8080 E0203 14:12:54.651409 20574 portforward.go:331] an error occurred forwarding 8080 -> 8080: error forwarding port 8080 to pod febaeb6b4747d87036534845214f391db41cda998a592e541d4b6be7ff615ef4, uid : unable to do port forwarding: socat not found.

I poked around the kubelet code and it looks like it needs it runs the socat binary to port forward connections:

https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/dockershim/docker_streaming.go

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

I also grep'ed through the repo files and I don't see any notes about socat being a pre-requisite. Would it be possible to note that each Kubernetes worker needs the socat binary installed in a pre-requisite section (I'll be glad to submit a documentation PR)? If this is documented elsewhere my apologies.

jbeda commented 6 years ago

Hey @Matty9191 -- yes -- it looks like socat needs to be present. I haven't hit this before personally but it looks like it is a long standing issue.

https://github.com/kubernetes/kubernetes/issues/19765

Not sure what we can do from the kuard side.

I'd like to see this go into the conformance tests but it isn't right now. This should be part of cluster conformance though.

Matty9191 commented 6 years ago

Hey Joe,

The conformance tests sound like a great place to stick this. I just wanted to share this piece of information so others reading the book and experimenting with kuard didn't bump into this issue.

Hope you are having a great day!