Skip to content

Feature Request: Kubernetes Operator #502

Closed

Description

@toonsevrin

I may implement this myself, so consider this a tracker.

Essentially I want to be able to locally access kubernetes services (in an already secured cluster) within the security of Tailscale. We have a ton of corporate services that are currently acessed with "kubectl port-forward", using tailscale would streamline this a lot (dns and no command line).

My preference goes to having a tailscale identity (IP) per services you wish to expose to the network. This can be achieved by having an operator that watches LoadBalancer Services. If they are labelled with "tailscale: true", the operator creates an identity and a proxy deployment that terminates the tailscale traffic for that identity, routing the traffic to the actual service.

What would be the best way to handle identity in this setup?

Activity

  1. danderson commented on Jun 24, 2020

    @danderson
    Member

    We're not going to work on this just yet, blocked on #504. The questions you're asking are exactly the ones we need to answer before building a Kubernetes operator, and we haven't thought about it at all yet. If you're interested in building this yourself, you're welcome to experiment with the tradeoffs and see what works best in the k8s ecosystem.

  2. toonsevrin commented on Jun 24, 2020

    @toonsevrin
    Author

    Once I do need this, I'll implement it myself :)

    Can you perhaps provide a bit more detail in #504 at the issues that you are facing with containerization, the potential solutions and why they are not immediately solveable?

    Thank you very much!

  3. zfogg commented on Jun 9, 2021

    @zfogg

    i really want to see this. please do it

  4. bithavoc commented on Jul 8, 2021

    @bithavoc

    This feature would be absolutely amazing, imagine using Tailscale for cross-cluster resource access 🥇

    There is money to be made here Tailscale, please take my money.

  5. niels-s commented on Aug 5, 2021

    @niels-s

    We recently deployed Tailscale on our k8s cluster, we had to tweak our CoreDNS config a bit, but right now, when DNS is enabled, you can do something like curl http://<svc name.<namespace>.svc.osig.lan.
    It's pretty minimal and doesn't come with cross-cluster connection or per-service settings like requested above. My colleague @alex-richman-onesignal is writing a blog post on it, pinging him to share the story once published.

  6. enigmatix commented on Aug 9, 2021

    @enigmatix

    I'd be very interested to learn exactly how you did it and if there were any issues. I'm currently working through an implementation myself @niels-s @alex-richman-onesignal

  7. bithavoc commented on Aug 9, 2021

    @bithavoc

    @niels-s how did you get your pods to talk to the MagicDNS Server in first place?

    My bad, I must have been doing something weird last time I tried it, I can totally hit IP Addresses from inside Kubernetes if the host is running Tailscale.

  8. bithavoc commented on Aug 9, 2021

    @bithavoc

    So I got MagicDNS working inside Kubernetes(K3S, Ubuntu 20.04), all I did was a simple edit to the ConfigMap for CoreDNS to prepend a new server just for beta.tailscale.net forwarding everything to 100.100.100.100(the nameserver IP of all users in the Beta) like this:

    beta.tailscale.net:53 {
            loop
            cache 10
            forward . 100.100.100.100
        }
    // ... the rest of the CoreDNS config file...
    

    So my config map now looks as follows:

    data:
      Corefile: |
        beta.tailscale.net:53 {
            loop
            cache 10
            forward . 100.100.100.100
        }
        .:53 {
            errors
            health
            ready
            kubernetes cluster.local in-addr.arpa ip6.arpa {
              pods insecure
              fallthrough in-addr.arpa ip6.arpa
            }
            hosts /etc/coredns/NodeHosts {
              ttl 60
              reload 15s
              fallthrough
            }
            prometheus :9153
            forward . /etc/resolv.conf
            cache 30
            loop
            reload
            loadbalance
        }
    

    Once I saved the config file, I reloaded the CoreDNS pods so they pick the new config map:

    kubectl rollout restart -n kube-system deployment/coredns
    

    And that's all I did, I was able to use MagicDNS from any pod in the cluster.

    Now that with this setup, you can use MagicDNS only with FQDN such as <hostname>.<tailscale-domain>.beta.tailscale.net.

    If you want to use just the hostname and have it resolve to tailscale MagicDNS, one approach would be to just use forward . 100.100.100.1000 in your .:53 server but I wouldn't recommend that since it may mess with the resolution of other services in the networking your cluster might depend on.

  9. 231 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    L2 FewP3 Can't get startedT0 New featurecontainersfrkuberneteson-hold

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions