Kubernetes Containerport Protocol Default Tcp Docs
You set up a pod network port by writing a port rule in your pod spec. The kubernetes containerport protocol default tcp docs explain that ports use TCP when you leave the protocol blank. Teams often give broad cluster roles to developers who write and fix these pod rules. Broad roles let users edit any pod, read logs, or run commands across whole namespaces. How kubernetes containerport protocol default tcp docs work with cluster roles When a team deploys an app, they list the network ports
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.
You set up a pod network port by writing a port rule in your pod spec. The kubernetes containerport protocol default tcp docs explain that ports use TCP when you leave the protocol blank. Teams often give broad cluster roles to developers who write and fix these pod rules. Broad roles let users edit any pod, read logs, or run commands across whole namespaces.
How kubernetes containerport protocol default tcp docs work with cluster roles
When a team deploys an app, they list the network ports that the container listens on. If the author skips the network protocol field, the cluster uses TCP by default. To write or change these pod specs, a user needs role permissions on the API server. In Kubernetes, a Role sets rules within one namespace. A ClusterRole sets rules across the entire cluster, including all namespaces and nodes.
Permissions in these roles are additive, which means there are no deny rules. A RoleBinding gives a user or group the permissions held in a Role for one namespace. A RoleBinding can also point to a shared ClusterRole while keeping the grant inside that single namespace. By contrast, a ClusterRoleBinding gives permissions across every namespace in the cluster at once.
To check if a port works, engineers often read pod logs or open a shell session. The API server treats pod logs and shell sessions as subresources. In role rules, you write a subresource with a slash, such as the pod log or exec path. If a role allows pod edits and subresource calls, the user can reach any container port or shell.
What native roles solve and the gap they leave open
Native roles and bindings control who can submit pod specs or start a pod session. They let you limit a developer to one namespace instead of the whole cluster. You can also split permissions so one role edits pod ports while another role only reads pod logs.
Kubernetes RBAC + Model Context Protocol (MCP) Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Still, native role checks stop once the API server approves the initial request. A role decides who can start a shell session or forward traffic to a TCP port. It does not inspect the individual commands or queries that run inside that open session. Also, resource name limits in roles do not filter create calls on subresources in the normal way. Once a developer enters a container, they can run any tool installed in that image. They can also query connected databases and view raw emails, phone numbers, or card numbers.
Securing container sessions and network checks in practice
To reduce risk, teams should avoid giving out ClusterRoleBindings for routine port checks. Start by creating small Roles that grant access to a single namespace only. Separate the right to update pod specs from the right to run interactive shell subresources. Even with tight roles, teams still need visibility into what happens after a session starts. Controlling each command in flight and rewriting sensitive data fields requires inspection at the command level.
Add request guardrails and response masking beside Kubernetes
Cluster roles and service accounts govern who reaches the Kubernetes API. Still, a broad role or agent can delete workloads or print sensitive values from ConfigMaps and logs. In practice, hoop.dev runs beside the API server as a sidecar for your Kubernetes API and checks every request and response alongside RBAC.
With hoop.dev Kubernetes controls, guardrails can allow listing Secret names while refusing reads of Secret data before execution. Data masking redacts matched keys in returned JSON responses and log streams in memory. Furthermore, hoop.dev holds SOC 2 Type II and is MIT licensed on GitHub.
Frequently asked questions
What happens if I omit the protocol on a container port?
When you leave out the protocol field in a pod port spec, the cluster selects TCP. You only need to state the protocol when your app needs UDP or SCTP traffic.
Can I add a deny rule to block a specific port edit in a Role?
No, role permissions in the cluster are strictly additive and do not support deny rules. To block an action, you must remove the grant from the Role or RoleBinding.
How do roles control who can test a port with a pod shell?
The API server checks if your Role or ClusterRole allows the pod exec subresource. If allowed, you can start a shell, and the role does not filter commands after that.
Related guides
In this post