-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Docker in k8s #160
Comments
Hi @danjenkins, I had something like this in the past on a customer cluster with a different application written in Go and this solved it for me: But it's good possible that you issue is related to how that docker image is build (alpine+static) |
Thanks @negbie ! I'll go and see if i can change the resolv.conf to add |
oh it cant be a default in the image due to how its all inherited... |
@danjenkins exactly we need to find a better way. |
@danjenkins something else. Does the behaviour change when you use TCP with heplify -nt flag? Like -nt tcp or -nt tls. Make sure to configure HEPTCPAddr or HEPTLSAddr in the heplify-server container. I would suggest to use TLS anyway. |
that won't change the host resolution though will it? I guess its using a different part of go etc.... I didnt want to add the overhead of TLS because its all contained within a k8s cluster. |
@danjenkins it shouldn't but Go's netstack has a lot of black magic behind the scenes so who knows ;) |
So i added
to the manifest for the dpeloyment and thats had no affect. Going to try doing a postrun change of resolv.conf |
@danjenkins too bad! Ok let me loop in @lmangani since he controls the sipcapture repo on dockerhub and the automatic builders. I would suggest to build an alpine static image which is tiny and a bigger one with the standard Go image as builder. |
Just tried
and that also appears to fail. annoyingly because the run command fails I can't exec into the container |
Just trying out sending via tcp instead, i doubt that'll have an affect but worth a go |
yup - |
@danjenkins ok I think we need more image options for the user to choose from. |
yeah, at this point i'd be fine with an ubuntu full blown base if it worked :D |
@negbie afaik all the images are Alpine based nowadays already. For |
@danjenkins we can make that happen - let's elect the next OS container to build and I'll take care of it |
@lmangani is it easy to build one with buster or stretch https://hub.docker.com/layers/golang/library/golang/buster/images/sha256-944405641f9fb0f322be1dfc4685b916df2de3df54525cf80822f8a0529f636f?context=explore and just push it to dockerhub with a test tag, then i can test it fast |
Ubuntu images are quite small too. |
yeah @negbie if we go with buster or stretch then it means its just a change of tag from the golang repo so theoretically no real change to your dockerfile etc etc |
@danjenkins makes sense let's go the frictionless way. |
so i just made a debian buster version (of course requires more changes because youre not using debian) But now i have
|
Seems like go deals with the full |
If i go back to shortened dns it still errors using buster.
|
Thanks for helping out @danjenkins. Did you try to remove the build flags here? RUN CGO_ENABLED=1 GOOS=linux go build -a --ldflags '-linkmode external -extldflags "-static -s -w"' -o heplify . and just use something like RUN CGO_ENABLED=1 GOOS=linux go build -o heplify . |
That was going to be my next question... I'm not knowledgable with Go - let me give that a go |
Error from the container now
|
Docker file I used was
|
@danjenkins I'm not sure if @lmangani uses this as build script but for me this docker file seems wrong. Whats about this:
|
Can't test it currently so take it with care. |
@negbie being very lazy here... it errored
|
ah! missing a / |
oh no that wasn;t it... |
This builds
Untested and pushed for your leisure: |
thanks @lmangani !! |
@lmangani that gives me the same error?
|
@danjenkins Currently hoping from meeting to meeting so I will come back to you this evening when I'm at home and can verfiy stuff I paste here ;) |
No problem :) |
@danjenkins how can i replicate this? (nevermind, I can, testing a fix) |
@danjenkins try again please
|
thanks! trying it out now |
@lmangani :( Now I have less useful logs....
|
@danjenkins in @lmangani build script I still see RUN CGO_ENABLED=1 GOOS=linux go build -a --ldflags '-linkmode external -extldflags "-static -s -w"' -o heplify . maybe this should be changed first. |
Sorry I'm not following what you're suggesting @negbie - been looking at this too long :D |
@negbie without the error above appears, with the full options it works (apparently) |
|
By default, |
@lmangani since some dns issues with Go apps on Kubernetes are due to how they are compiled I want to make sure that no further flags are provided so instead of RUN CGO_ENABLED=1 GOOS=linux go build -a --ldflags '-linkmode external -extldflags "-static -s -w"' -o heplify . use just RUN CGO_ENABLED=1 GOOS=linux go build -o heplify . |
moving back to udp didnt solve the issue.... how do i get the rest of the logging back? :S |
@negbie I tried with your RUN command and I got I'm kinda stuck now and this is holding up a deployment - this is for a kamailio k8s deployment so im thinking about just enabling kamailio do send the data instead... but really didnt want to do that - any ideas? |
Hi @danjenkins Im sure we can fix this but I need at least 30min spare time to look into it. Will try to get them today. |
@negbie I'm not sure if the issue is with you now. I'd hold off for now! |
@danjenkins I used this Dockerfile and tried to do as less clever things as possible:
Of course this means that the image isn't the smallest one but I hope it has no DNS issues. I pushed this to dockerhub under negbie/heplify:latest so if you trust me you can test this or build it quickly yourself. |
thanks @negbie ! I think this is a specific pod issue on k8s and wasnt an issue of yours at all :( sorry for the noise! I'll leave this issue open while I continue debugging :) |
@danjenkins ok no problem. If you find the root cause it would be great if you could post the pod issue here aswell. I'm always interested in all kind of kamailio k8s deployments. |
Yup it was k8s. So in this example the pod was set to hostNetwork = true. And so doesnt get access to the cluster DNS. you have to set |
@danjenkins it's always k8s :D Thanks for giving the solutions aswell! |
The container formed with the image from the repo (on dockerhub) complains about dns entries that are available not being there.
I've brought up the k8s dnsutils pod
kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml
and that proves that the dns entries are available but heplify complains. I can only summize that due to how go applications are compiled it's not accessing the global dns available in this case.Not really sure where to go from here in debugging this - any help would be greatly appreciated.
startup log output is
The text was updated successfully, but these errors were encountered: