Skip to content

Kubernetes Operator: users need to manually create IngressClass resource to use Tailscale Ingress on some EKS setups #10820

Closed

Description

@irbekrm

Current behaviour

Users can expose cluster workloads to tailnet using Ingress. In this case Tailscale Kubernetes operator acts as a Kubernetes ingress controller. In Kubernetes multiple ingress controllers of diferent types can co-exist in a cluster. Ingress class name is used to determine whether a controller should parse an Ingress resource.

Our operator only creates resources for Ingresses with class name 'tailscale' (it just does string comparison on ingress.spec.ingressClassName field).

Problem

Ingress spec guides controllers towards setting ingress.spec.className to a name of an IngressClass resource (that an ingress controller has been configured with).
We are aware of one validating webhook that comes with the AWS load balancer controller that validates all Ingress resources applied to cluster and rejects any where an IngressClass with a name of spec.ingressClassName does not exist for that Ingress. (See code and a related discussion - looks like they are not going to change this behaviour).
Currently users who want to create a Tailscale Ingress in an EKS cluster with AWS load balancer controller deployed need to manually create a 'tailscale' IngressClass resource.

Could IngressClass be useful for us?

  • IngressClass makes it easier for multiple instances of the same controller type to co-exist in a cluster. (Cluster admins can configure each with its own IngressClass and Ingress resources can then be configured to be implemented by the desired controller instance using class name. We currently do not support multiple Tailscale operator instances in the cluster, but we might in the future.
  • ingressclass.spec.parameters allows passing a reference to an arbitrary resource for that class. That might be useful if we start supporting multiple operator instances.
  • IngressClass has a way of specifying that a certain IngressClass should be default in the cluster. That would allow users to, for example, migrate all existing Ingress resource in cluster to be Tailscale Ingresses by deploying a 'default' Tailscale IngressClass. I am not sure whether folks will be wanting to do that- our Ingress implementation is somewhat different than i.e ingress-nginx (for example, we don't use ingress.spec.tls.secretName that would be commonly set on other Ingresses, the DNS name is different- so I think migrating to Tailscale Ingress would anyway require more work and consideration than just switching IngressClass).

How to solve

The simplest way would be to just include a default IngressClass resource with our installation manifests (other ingress controller implementation installations include that), but not allow users to modify it (provide a different class etc) and not fail when it does not exist for some reason.
Should we also validate the IngressClass in controller code?
We could add a check that the IngressClass exists and log a warning if it does not- that would make it easier for us to start using the resource in future if needed.
We probably want to document that we don't accept classes with different names (I don't see why anyone would need to modify the name) and don't accept default class annotation.

Activity

  1. self-assigned this
    on Jan 11, 2024
  2. irbekrm commented on Jan 16, 2024

    @irbekrm
    ContributorAuthor

    We've added a default IngressClass in #10823.

    unstable-v1.57.90 tailscale/k8s-operator image tag/1.57.90 Helm chart from tailscale dev Helm repository contains this change- do let us know if there are any further issues!

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

Metadata

Metadata

Assignees

Labels

L3 Some usersP1 Nuisancekubernetes

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions