You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have minimal support for containers, in that a Dockerfile exists. However, that Dockerfile doesn't embed correct version numbers, doesn't support authkey enrollment, and we have the same problem that Kubernetes had with incompatible host vs. container iptables. As such, we don't currently publish official images anywhere.
This is a tracking bug to make the container image good enough that we can support it as an official platform.
Reacted by Dmitri Fedotov, Anthony Dodd, Nikhil Srivastava, Ben McCann, Daniel Seripap, Jamie, Maxime V., Simon Horlick, Yonni, Bradley Wright and 32 more
Reacted by Em Karisch, rick, Levi Roberts and subinghong
This was enough to let me access services via ingress on a cluster with no inbound access, so i stopped tinkering there!
Only tested with EKS and the AWS VPC CNI, might make a difference...
Reacted by Szabolcs Gelencsér, Carlton, Nick Sweeting, Florian Forster, Guy Maliar and Enkh Mandakh
For #502 (an operator to expose a k8s service to your tailscale network), the Tailscale network only has to be accessible within the operator container itself. Would it be possible to get rid of these capabilities somehow in this case?
I think that option was required to get the tun kernel module visible in the container.
My setup doesn't seem give host access either, only access to the pod, the tailscale tunnel doesn't appear on the host, nor do iptables rules.
You're right, after a bit of messing about privileged isn't required.
Without privileged you do, however, have to create /dev/net/tun yourself with mknod /dev/net/tun c 10 200.
Otherwise this happens:
3.0M/19.1M Starting userspace wireguard engine with tun device "tailscale0"
3.1M/19.1M Linux kernel version: 4.14.173-137.229.amzn2.x86_64
3.1M/19.1M is CONFIG_TUN enabled in your kernel? `modprobe tun` failed with: modprobe: can't change directory to '/lib/modules': No such file or directory
3.1M/19.1M CreateTUN: can't create TUN device; /dev/net/tun does not exist
wgengine.New: can't create TUN device; /dev/net/tun does not exist
Updated the gist!
Currently I don't think all the networking setup can be done at init.
I tried manually creating the tailscale0 tun device in an init container with NET_ADMIN.
The tunnel shows up in the main container (you still have to create /dev/net/tun though) however tailscaled tries to modify it (even if you set the MTU to 1280 in init) and that fails.
2.9M/19.0M Starting userspace wireguard engine with tun device "tailscale0"
3.1M/19.0M Linux kernel version: 4.14.173-137.229.amzn2.x86_64
3.2M/19.0M is CONFIG_TUN enabled in your kernel? `modprobe tun` failed with: modprobe: can't change directory to '/lib/modules': No such file or directory
3.2M/19.0M CreateTUN: failed to set MTU of TUN device
wgengine.New: failed to set MTU of TUN device
Maybe this would be feasible if tailscaled had some kind of init mode? But there might be other stuff being done during normal operation that requires NET_ADMIN too 🤷♂️.
For me the 2 biggest pain points in running tailscale in containers/k8s are the 2 command startup and the state file.
Starting tailscaled and then having to configure it with another command is not much fun in containers.
Some way to start tailscaled with all the necessary config (either flags, env vars or config file, don't really care) would be ideal.
And then having to keep the state file around to prevent the IP changing if the container is restarted also sucks.
DNS automation could fix this, I don't really care what the IP is just that my DNS entries keep working when the container restarts.
@hamishforbes I was thinking about the persistent volume (I agree that that sucks). I think it makes a lot of sense to have an operator manage the identities and push them into Secrets/ConfigMaps. That way no persistent volumes are required (not even for the Operator).
Perhaps you can create a PR to fix the MTU issue? I still have one more exam in a couple of days so won't be able to look at this myself up to then :')
Also, is there already an issue created for running in non-daemon mode, I agree that that would be nice to have.
FYI - A working cillium kubernetes + tailscale setup config got posted here: cilium/cilium#16266
Small note is that this is for accessing the network of an existing cilium cluster and not for having an encrypted network between every node by using tailscale and cilium (something that I would really want).
That's likely because the dockerfile is older and hasn't been updated. Speaking as an experienced Alpine user the dockerfile as-is should work fine if you replace 3.11 with 3.14.
In 1.12 the userspace-networking mode handles operation in container environments which do not have CAP_NET_ADMIN set.
At this point I'm going to close this as done, I think the support for containers and for serverless environments overall is pretty good. If there are specific environments which do not work or issues encountered, please open new bugs. This one is long and covers a number of issues already.
Reacted by brybalicious, Florian Forster and Nick Sweeting
Reacted by brybalicious, pratikbin and Madhava Jay
Activity
bradfitz commentedon Jun 24, 2020
When we do this, revisit #301 from @khos2ow
hamishforbes commentedon Jun 24, 2020
FWIW this is my hacky setup for running tailscale in a sidecar with nginx-ingress.
It might help other people coming across this issue.
https://gist.github.com/hamishforbes/2ac7ae9d7ea47cad4e3a813c9b45c10f
Just add a persistent vol for state + secret with your authkey.
This was enough to let me access services via ingress on a cluster with no inbound access, so i stopped tinkering there!
Only tested with EKS and the AWS VPC CNI, might make a difference...
toonsevrin commentedon Jun 25, 2020
@hamishforbes "privileged: true, NET_ADMIN"
For #502 (an operator to expose a k8s service to your tailscale network), the Tailscale network only has to be accessible within the operator container itself. Would it be possible to get rid of these capabilities somehow in this case?
hamishforbes commentedon Jun 25, 2020
I think that option was required to get the
tunkernel module visible in the container.My setup doesn't seem give host access either, only access to the pod, the tailscale tunnel doesn't appear on the host, nor do iptables rules.
toonsevrin commentedon Jun 25, 2020
Pretty sure you won't need privileged then:
Source: Docker docs
Do you think networking setup can be done in an initContainer? Similar to how istio only requires NET_ADMIN on init?
hamishforbes commentedon Jun 25, 2020
You're right, after a bit of messing about privileged isn't required.
Without privileged you do, however, have to create
/dev/net/tunyourself withmknod /dev/net/tun c 10 200.Otherwise this happens:
Updated the gist!
Currently I don't think all the networking setup can be done at init.
I tried manually creating the
tailscale0tun device in an init container withNET_ADMIN.The tunnel shows up in the main container (you still have to create
/dev/net/tunthough) howevertailscaledtries to modify it (even if you set the MTU to 1280 in init) and that fails.Maybe this would be feasible if tailscaled had some kind of init mode? But there might be other stuff being done during normal operation that requires
NET_ADMINtoo 🤷♂️.For me the 2 biggest pain points in running tailscale in containers/k8s are the 2 command startup and the state file.
Starting
tailscaledand then having to configure it with another command is not much fun in containers.Some way to start
tailscaledwith all the necessary config (either flags, env vars or config file, don't really care) would be ideal.And then having to keep the state file around to prevent the IP changing if the container is restarted also sucks.
DNS automation could fix this, I don't really care what the IP is just that my DNS entries keep working when the container restarts.
toonsevrin commentedon Jun 25, 2020
@hamishforbes I was thinking about the persistent volume (I agree that that sucks). I think it makes a lot of sense to have an operator manage the identities and push them into Secrets/ConfigMaps. That way no persistent volumes are required (not even for the Operator).
toonsevrin commentedon Jun 25, 2020
Perhaps you can create a PR to fix the MTU issue? I still have one more exam in a couple of days so won't be able to look at this myself up to then :')
Also, is there already an issue created for running in non-daemon mode, I agree that that would be nice to have.
59 remaining items
wgengine/netstack: Allow userspace networking mode to expose subnets (#…
DentonGentry commentedon May 20, 2021
userspace support debuted in 1.6 for local containers: https://tailscale.com/kb/1112/userspace-networking/
In 1.8 the support was broadened to include Heroku and Google Cloud Run:
StevenACoffman commentedon May 21, 2021
FYI - A working cillium kubernetes + tailscale setup config got posted here: cilium/cilium#16266
unixfox commentedon May 21, 2021
Small note is that this is for accessing the network of an existing cilium cluster and not for having an encrypted network between every node by using tailscale and cilium (something that I would really want).
DentonGentry commentedon Jun 26, 2021
In 1.10 the userspace-networking mode added support for AWS Lambda.
pratikbin commentedon Jul 8, 2021
Edit: Apologies. Found it in this very repo
DentonGentry commentedon Jul 8, 2021
https://github.com/tailscale/tailscale/blob/main/Dockerfile
pschulten commentedon Jul 8, 2021
Now, this is an example of a clean Dockerfile, 😊
abh commentedon Jul 8, 2021
@DentonGentry Why Alpine 3.11 instead of 3.14? (Apologies if that's covered already elsewhere and I missed it).
Xe commentedon Jul 8, 2021
That's likely because the dockerfile is older and hasn't been updated. Speaking as an experienced Alpine user the dockerfile as-is should work fine if you replace 3.11 with 3.14.
DentonGentry commentedon Jul 21, 2021
In 1.12 the userspace-networking mode handles operation in container environments which do not have CAP_NET_ADMIN set.
At this point I'm going to close this as done, I think the support for containers and for serverless environments overall is pretty good. If there are specific environments which do not work or issues encountered, please open new bugs. This one is long and covers a number of issues already.
brybalicious commentedon Aug 9, 2021
Amazing. I will try out the new functionality next time I implement tailscale!
[-]Support running in containers (Docker, Kubernetes)[/-][+]Support running in containers (Serverless)[/+]metaskills commentedon May 31, 2023
FWIW, I created a Lambda Container project with container packages that make it a bit easier thank Lambda layers. Details here https://github.com/rails-lambda/tailscale-extension