Azure Kubernetes Monitoring

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up azure kubernetes monitoring by collecting cluster metrics and reading container logs. Teams also track API server events to check app health and user actions. Most platform teams start by granting broad cluster roles to on-call engineers. They want developers to read logs and fix broken pods fast. When roles are too broad, users gain excess permissions across every namespace. A simple log check can turn into full shell access on production workloads. How native azure kubernetes moni

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 azure kubernetes monitoring by collecting cluster metrics and reading container logs. Teams also track API server events to check app health and user actions. Most platform teams start by granting broad cluster roles to on-call engineers. They want developers to read logs and fix broken pods fast. When roles are too broad, users gain excess permissions across every namespace. A simple log check can turn into full shell access on production workloads.

How native azure kubernetes monitoring permissions work

Kubernetes uses role-based access control to manage who can view cluster data. In this system, permissions are additive, and there are no deny rules. You define a Role to set permissions inside a single namespace. You use a ClusterRole for cluster-wide objects like nodes or all namespaces. Then, you attach those rules to users with a RoleBinding or ClusterRoleBinding.

To support azure kubernetes monitoring, engineers need read permissions on pods and logs. Kubernetes treats pod logs as a subresource in the API path. You grant access to the pod log subresource so users can read output. This lets developers check app errors without changing the pod state. Teams also grant access to the pod exec subresource for deeper checks. The exec subresource lets an engineer run live commands inside a container.

API server audit logs work alongside these roles to track cluster activity. The API server records each request made by a user or service account. Platform teams send these audit records and container logs to a central log store. There, they set up alerts for failed pods, high CPU use, or odd API calls.

What native monitoring solves and the gap it leaves open

Native roles and audit logs solve the basic problem of who can enter the cluster. You can restrict log reading to one namespace with a standard RoleBinding. You can also see which user started an interactive shell session on a pod. Metrics and log streams tell you when a node runs out of memory. They also show when a container crashes and restarts.

Still, native setup leaves a major gap during live debugging sessions. Role bindings decide who logs in, not what individual commands do in flight. Once a user has permission for the pod exec subresource, RBAC stops checking. The Kubernetes API server records that an exec session started on a specific pod. It does not inspect or control the shell commands run inside that session.

Azure RBAC + Kubernetes RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

This creates a blind spot for security and platform teams during incidents. An engineer investigating an alert might read sensitive environment variables or local files. If a pod holds database keys, those keys sit exposed inside the shell. Also, container log streams often print customer emails, phone numbers, or card numbers. Standard role bindings cannot rewrite matched fields in results before they reach the screen. Teams need a way to inspect commands and mask sensitive output in real time.

Scoping cluster roles for safer day-to-day checks

You can reduce risk by splitting read-only monitoring from live container debugging. Create a base Role that grants access only to pods and the log subresource. Bind this role to developers for their specific app namespaces. Do not include the exec subresource or secret read rules in this daily role.

Keep cluster-wide roles limited to automated monitoring agents and core platform tools. When engineers need to run commands inside a pod, treat that action separately. By separating log viewing from shell execution, you keep routine checks safe and clean.

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

How do I let developers read pod logs without giving shell access?

Create a Kubernetes Role that grants get and list verbs on pods and the pod log subresource. Leave out the pod exec subresource so users can read output without running container commands.

Does Kubernetes RBAC support deny rules for sensitive namespaces?

No, Kubernetes RBAC permissions are additive and do not include deny rules. To block access to a namespace, use namespace-scoped RoleBindings instead of broad ClusterRoleBindings.

What do API server audit logs miss during a pod exec session?

API server audit logs show who opened the exec session and which pod they targeted. They do not capture the interactive shell commands or screen output that happen inside the container.

The query runs. The emails stay hidden.