K3s Ingress

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up k3s ingress, you define routing rules that send outside traffic to cluster services. K3s ships with a built-in controller that reads these rules and opens network ports. Most teams start by pointing a domain name at their cluster nodes. Then they write routing rules to match web paths to internal apps. Trouble starts when teams pair broad network routing with wide cluster roles. One loose role lets a user inspect or change every routing rule in the cluster. How k3s ingress works unde

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 set up k3s ingress, you define routing rules that send outside traffic to cluster services. K3s ships with a built-in controller that reads these rules and opens network ports. Most teams start by pointing a domain name at their cluster nodes. Then they write routing rules to match web paths to internal apps. Trouble starts when teams pair broad network routing with wide cluster roles. One loose role lets a user inspect or change every routing rule in the cluster.

How k3s ingress works under the hood

A K3s cluster runs a default routing controller right out of the box. This controller watches the cluster API for new routing objects. When an engineer adds a routing rule, the controller updates its live routing table. Outside traffic hits the node port first. A local load balancer then passes the packet to the routing controller pod. Finally, the controller sends the request to the right app pod based on the host header.

Teams also use role-based rules to control who can edit these network paths. You bind a cluster role to a user or a group. That role states which namespaces the engineer can read or change. If you scope the role well, a developer can only expose apps in one namespace. You can also swap the default controller for another standard Kubernetes routing controller during setup. The core flow stays the same no matter which controller you pick.

What native routing solves and what it misses

Native routing rules solve the problem of getting web traffic into your cluster pods. They let multiple apps share one public IP address and one TLS certificate. Role bindings also stop unapproved users from adding new public routes through the cluster API. Together, these tools handle basic north-south network traffic and high-level API permissions.

Still, network routing and cluster roles leave a large operational gap during daily work. Cluster roles only check who logs in and which API objects they can touch. When an engineer opens an interactive shell into a pod, routing logs show nothing useful. Native roles cannot check individual commands or database queries once a session starts. If a developer runs a destructive command inside a container, the cluster allows it. Static keys and shared certificates also sit inside cluster secrets where wide roles can read them.

Ingress: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Securing live cluster sessions and data

Closing this gap requires controls that work at the command and query level. Teams need to check every action in flight rather than just the initial network route. When an engineer needs to fix a broken pod, broad cluster admin rights create high risk. A safer setup checks each command before it runs on the target pod. It also rewrites sensitive data like emails, phone numbers, and card numbers in query results. This approach keeps daily debugging fast while stopping bad commands and data leaks.

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

Does K3s include an ingress controller by default?

Yes, K3s installs and runs a default routing controller when you start the cluster. You can disable this default controller at startup if you prefer to install another one.

How does TLS work with k3s ingress rules?

You store your TLS certificate and private key inside a standard Kubernetes secret object. The routing rule references that secret so the controller can handle encrypted web traffic.

Why are Kubernetes roles not enough to secure cluster access?

Cluster roles only decide who can start a session or edit a resource object. They do not inspect the actual shell commands or database queries an engineer runs inside a pod.

The query runs. The emails stay hidden.