Kubectl Get Ingress Class

Published
Length
3 min read

Luis Felipe Dias

All posts

To list routing controllers in your cluster, run a kubectl get ingress class request. This request tells the Kubernetes API server to return all cluster-wide routing classes. Teams often grant broad cluster roles so engineers can inspect these routing objects. Still, broad roles expose other cluster resources and create security risks during daily work. How kubectl get ingress class works with Kubernetes RBAC In Kubernetes, an IngressClass is a cluster-scoped resource rather than a namespaced

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

To list routing controllers in your cluster, run a kubectl get ingress class request. This request tells the Kubernetes API server to return all cluster-wide routing classes. Teams often grant broad cluster roles so engineers can inspect these routing objects. Still, broad roles expose other cluster resources and create security risks during daily work.

How kubectl get ingress class works with Kubernetes RBAC

In Kubernetes, an IngressClass is a cluster-scoped resource rather than a namespaced object. It defines which controller handles traffic rules for apps across the whole cluster. When an engineer runs a read command, the client contacts the API server. The API server checks if the user has permission to read cluster objects.

Kubernetes uses Role-Based Access Control to manage these permissions through additive rules. There are no deny rules in Kubernetes RBAC. A regular Role only sets permissions inside one single namespace. Because routing classes sit outside namespaces, a standard Role cannot grant permission here.

Instead, admins must use a ClusterRole and a ClusterRoleBinding for this task. A ClusterRole covers cluster-scoped resources or resources across all namespaces at once. A ClusterRoleBinding then links that role to a user or a team group. When both exist, the API server returns the list of routing classes.

Why cluster-wide permissions create operational gaps

Native Kubernetes RBAC solves the basic problem of who can call the API. You can create a specific ClusterRole that only allows reading routing class objects. This stops unauthorized users from changing traffic controllers or deleting cluster nodes. On paper, this setup keeps your cluster safe while letting developers debug traffic.

In practice, managing tiny roles for every single cluster resource takes huge effort. Teams often take a shortcut and bind developers to wide built-in cluster roles. Once an engineer holds a broad role, they can read much more than routing rules. They might read secrets, view pod logs, or run commands inside live containers.

Also, native RBAC only checks permissions when a request hits the API server. It decides who logs in and which general resource types they can touch. It does not inspect individual commands in flight or filter sensitive data out. If a command returns sensitive fields like emails or card numbers, the user sees them. Standard roles also require static kubeconfig files on laptops, which are hard to revoke.

Get Ingress Class: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

How to scope cluster inspection for engineering teams

Start by auditing all active ClusterRoleBindings in your production and staging clusters today. Remove bindings that grant broad read or write rights across all cluster resources. Build a minimal ClusterRole that only grants read verbs on the routing class resource. Bind that small role to the specific group that troubleshoots network traffic.

Next, separate cluster inspection duties from pod execution and secret reading duties. Engineers who check network controller names rarely need to read app secrets. Keep those permissions in separate roles and grant them only for specific namespaces. This limits the blast radius if a developer laptop or key gets stolen.

Govern kubectl and API calls in flight

Identity providers and Kubernetes RBAC decide who logs into a cluster. They cannot redact keys inside returned JSON objects or hold a risky delete call for review. By design, hoop.dev runs as an open-source proxy, a sidecar for your Kubernetes API, checking requests and responses without replacing RBAC.

First, hoop.dev guardrails refuse banned methods, paths, or headers before they run. Next, hoop.dev data masking rewrites sensitive keys in returned Secret, ConfigMap, and log responses in memory, and writes each decision to the audit trail. Explore the repo on GitHub.

Frequently asked questions

Why does a namespace Role fail when listing routing classes?

A standard Role only grants permissions for objects inside one specific namespace. Because routing classes are cluster-scoped resources, you must use a ClusterRole and ClusterRoleBinding.

Can I add a deny rule to block secret access in a broad ClusterRole?

No, Kubernetes RBAC permissions are purely additive and do not support deny rules. To block access, you must remove the broad role and assign smaller roles.

Do engineers need write permissions to check which routing controller is default?

No, viewing the default controller only requires read permissions on the cluster resource. Granting list and get verbs in a ClusterRole is enough for inspection.

Short role checks help teams work fast. Simple rules make each review clear. Good logs keep every team safe. Scoped keys stop bad changes early.

The query runs. The emails stay hidden.