Skip to content

[BUG] Kubernetes label provider access crashes instead of being disabled #1011

Description

@tagdara

Describe the Bug

Using Tiny in a bare metal kubernetes cluster (stock v1.34.3), and just did an in-place version update with renovate and encountered the following error:

Failed to access Ingress API, Kubernetes label provider will be disabled error="ingresses.networking.k8s.io is forbidden: User "system:serviceaccount:production:default" cannot list resource "ingresses" in API group "networking.k8s.io" at the cluster scope" api=networking.k8s.io/v1 stream=app

Followed by:
Failed to execute command: command tinyauth error: failed to bootstrap app: failed to initialize services: failed to get label provider: failed to invoke kubernetes service: could not build arguments for function

Instead of being disabled, it feels like a crash.

Solved with the following manifest that was not previously needed, so my problem is resolved but wanted to report it as a consideration for others who might be upgrading


apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: tinyauth-ingress-reader
rules:

  • apiGroups: ["networking.k8s.io"]
    resources: ["ingresses"]
    verbs: ["get", "list", "watch"]

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tinyauth-ingress-reader-binding
subjects:

  • kind: ServiceAccount
    name: default
    namespace: production
    roleRef:
    kind: ClusterRole
    name: tinyauth-ingress-reader
    apiGroup: rbac.authorization.k8s.io

How to Reproduce

Update in place from 5.0.3 to 5.1.0 in k8s

image: ghcr.io/tinyauthapp/tinyauth:v5.1.0
imagePullPolicy: IfNotPresent

Expected Behavior

In place upgrade runs instead of crashing.

Additional Context

I only use Tiny with NGINX Gateway Fabric and Gateway API, using the following snippet:


apiVersion: gateway.nginx.org/v1alpha1
kind: SnippetsFilter
metadata:
name: tinyauth-auth-filter
namespace: production
spec:
snippets:
- context: http.server.location
value: |
# Send auth subrequest
auth_request /tinyauth;

    # Intercept 401 and redirect directly via an inline error page target
    error_page 401 =302 https://tinyauth.[redacted]/login?redirect_uri=$scheme://$http_host$request_uri;

    # The internal validation location endpoint
    location = /tinyauth {
        internal;
        proxy_pass http://tinyauth.production.svc.cluster.local:3000/api/auth/nginx;
        proxy_pass_request_body off;
        proxy_set_header Content-Length "";
        proxy_set_header x-forwarded-proto $scheme;
        proxy_set_header x-forwarded-host $http_host;
        proxy_set_header x-forwarded-uri $request_uri;
    }

And then in my httproutes:

rules:

  • matches:
    • path:
      type: PathPrefix
      value: /
      filters:
      • type: ExtensionRef
        extensionRef:
        group: gateway.nginx.org
        kind: SnippetsFilter
        name: tinyauth-auth-filter

Logs

2026-07-16T04:16:04Z INF Starting Tinyauth version: v5.1.0 stream=app
2026-07-16T04:16:04Z WRN Failed to access Ingress API, Kubernetes label provider will be disabled error="ingresses.networking.k8s.io is forbidden: User "system:serviceaccount:production:default" cannot list resource "ingresses" in API group "networking.k8s.io" at the cluster scope" api=networking.k8s.io/v1 stream=app
Failed to execute command: command tinyauth error: failed to bootstrap app: failed to initialize services: failed to get label provider: failed to invoke kubernetes service: could not build arguments for function "github.com/tinyauthapp/tinyauth/internal/bootstrap".(*BootstrapApp).getLabelProvider.func1 (/tinyauth/internal/bootstrap/service_bootstrap.go:91): failed to build *service.KubernetesService: received non-nil error from function "github.com/tinyauthapp/tinyauth/internal/service".NewKubernetesService (/tinyauth/internal/service/kubernetes_service.go:60): failed to access ingress api: ingresses.networking.k8s.io is forbidden: User "system:serviceaccount:production:default" cannot list resource "ingresses" in API group "networking.k8s.io" at the cluster scope

Operating System

No response

Browser

No response

Tinyauth Version

No response

Docker Version (if applicable)

No response

Human Written Confirmation

  • I confirm this issue was written by me and not generated by an LLM or AI assistant.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions