Kubectl Get Ingress Command
The kubectl get ingress command fetches routing rules from your Kubernetes cluster API server. It lists hosts, paths, and backend services for traffic entering your cluster. Teams run this check every day to fix broken routes and inspect network rules. Still, teams often grant broad cluster roles just to let engineers read these routes. Overly broad roles expose other sensitive cluster objects to every user on the team. How the kubectl get ingress command works with RBAC When an engineer runs
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.
The kubectl get ingress command fetches routing rules from your Kubernetes cluster API server. It lists hosts, paths, and backend services for traffic entering your cluster. Teams run this check every day to fix broken routes and inspect network rules. Still, teams often grant broad cluster roles just to let engineers read these routes. Overly broad roles expose other sensitive cluster objects to every user on the team.
How the kubectl get ingress command works with RBAC
When an engineer runs the kubectl get ingress command, the client contacts the API server. The API server checks who the user is and what role they hold. Kubernetes uses role-based rules to control who can read or change network objects. In this system, permissions are purely additive, and there are no deny rules. You start with zero access and gain rights through assigned roles.
A Role sets permissions inside one single namespace. A ClusterRole is not tied to one namespace and can cover the whole cluster. It can grant read access to namespaced objects across all namespaces at once. To give a user these rights, an admin creates a binding. A RoleBinding grants permissions inside one specific namespace for that team. It can point to a local Role or a shared ClusterRole. A ClusterRoleBinding grants those permissions across the entire cluster at once.
When you run the ingress check, the API server looks at the URL resource name. Your active binding must allow the get or list action on ingress objects. If the binding matches your namespace, the server returns the routing table. If you use a ClusterRoleBinding, you can list ingress routes in every namespace.
Why native roles are not enough for cluster safety
Native roles and bindings do a good job of controlling who can log in. They let admins limit a user to one namespace or one resource type. If an engineer only needs to view ingress routes, a small Role handles that well. It blocks that user from deleting pods or reading secret keys in other namespaces.
Still, static roles leave a big gap in day-to-day operations. Native permissions are all-or-nothing once the user logs in to the cluster. A role decides who can run a request, not what happens during the session. Because rules are purely additive, you cannot add a rule to block one bad action. If a user gets a wide ClusterRoleBinding for on-call work, they keep it all day.
GCP Security Command Center: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Also, engineers have to hold local kubeconfig files on their laptops to run commands. Those files often hold long-lived keys or tokens that sit on disk. Native roles also do not rewrite sensitive values that might appear in command output. If an ingress annotation holds an internal email or phone number, the raw text shows up. Admins also lack a simple way to approve single commands before they run.
How to scope ingress checks for your team
To keep your cluster safe, start with the smallest Role possible. Create a Role in one namespace that only allows read actions on ingress objects. Bind that Role to your team group with a standard RoleBinding. Avoid using a ClusterRoleBinding unless a team truly manages network routes for every single app.
Next, review your bindings often to remove old permissions that teams no longer need. Since Kubernetes has no deny rules, adding new bindings only makes access wider over time. Keep write rights separate from read rights so routine checks cannot break live traffic. When someone needs to change an ingress rule, grant that write access only for the task.
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 sits inline as an open-source proxy, a sidecar for your Kubernetes API, without replacing RBAC. On every production call from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for human approval.
First, hoop.dev guardrails refuse banned methods, paths, or headers before they run or hold risky deletes for review. 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
What does the kubectl get ingress command show by default?
It shows the ingress name, class, host names, IP addresses, ports, and age inside your current namespace. This helps engineers see how external traffic reaches internal services.
Should I use a RoleBinding or a ClusterRoleBinding for ingress checks?
Use a RoleBinding for most app teams so they only see routes in their own namespace. Save ClusterRoleBinding for platform teams who must check ingress routes across all namespaces.
Can I add a deny rule to block access to one specific ingress?
No, Kubernetes RBAC permissions are purely additive and do not support deny rules. To restrict a user, you must remove their wide binding and grant a narrower Role.
Related guides
In this post