Skip to content

lookout audit netpol

NetworkPolicy coverage posture: namespaces where nothing restricts ingress or egress at all, and individual workloads that fell through the selectors of the policies covering their neighbours, and individual policies whose selector matches no workload at all. Coverage means isolation — some policy selects the pod and names the direction — not that the rules it then applies are tight. hostNetwork templates are excluded, since NetworkPolicy cannot constrain them. Scope with —namespace or -A; scanned counts pod templates examined.

MCP tool: k8s_audit_netpol (MCP profile: audit)

Terminal window
lookout audit netpol [flags]
FlagTypeDefaultMeaning
--skip-system-namespacesbool—skip system namespaces matching the active posture policy’s system_namespaces patterns
--policystring—path to a YAML posture policy file
--profilestring—built-in posture profile: default|strict|onboarding|gke-autopilot
--onlystring—comma-separated check kind or kind/reason globs to run exclusively
--skipstring—comma-separated check kind or kind/reason globs to skip
--min-severitystring—minimum finding severity to emit: info|warning|critical
--setstring—comma-separated check parameter overrides (<kind>.<param>=<val>)
FlagTypeDefaultMeaning
--namespacestring—limit the scan to one namespace
-Abool—scan all namespaces
--workloadstring—target one workload as <Kind>/<namespace>/<name>, e.g. Deployment/prod/api
--sinceduration—how far back to look (0 = command default)
--formatstringlogfmtoutput format: logfmt|json (one record per line either way)
--timeoutduration10sabort the invocation after this long (exit 1)
--kubeconfigstring—path to a kubeconfig file, instead of $KUBECONFIG / ~/.kube/config
--kubeconfig-dirstring—directory of kubeconfig files to fan out across (mutually exclusive with —kubeconfig); each finding is stamped with cluster=<label> and the summary reports clusters=<n>
--contextstring—kubeconfig context to read, instead of its current-context. Selects a cluster for THIS invocation only — nothing is written back — so concurrent invocations can target different clusters. Reported as context=<name> in the summary line
--contextsstring—comma-separated kubeconfig contexts to fan out across, or ’*’ for every context in the selected kubeconfig(s) (mutually exclusive with —context); each finding is stamped with cluster=<label> and the summary reports clusters=<n>
--concurrencyint4maximum concurrent cluster executions when fanning out with —contexts or —kubeconfig-dir
--google-authstring—how Google Cloud and GKE DNS requests authenticate: auto (default: honors LOOKOUT_GOOGLE_AUTH, CORE_AGENT_GOOGLE_AUTH, MAST_GOOGLE_AUTH), adc, or injected (static placeholder bearer token, zero GCE metadata lookups)
--exemptionsstring—path to a git-reviewed exemption file (YAML); covered findings are ANNOTATED with their reason and expiry and counted as exempt=<n> in the summary, never dropped

Every kind= this command can emit, and the severities it carries them at. Nothing else appears in its output; a kind absent from a run means the check looked and found nothing. See the finding-kind glossary for the whole vocabulary.

KindSeverityClaim
audit.netpol_missingwarning, infonothing restricts this direction for the subject — a namespace with no policy at all, or a workload the covering policies’ selectors miss; info for the egress direction, where no policy is a defensible default
audit.netpol_selects_nothingwarningthis NetworkPolicy’s podSelector matches no workload in its namespace, so neither its isolation nor its allow rules apply to anything; reported only where the namespace claim does not already say the namespace’s policies select nothing
audit.network_policy_allow_allwarning, infothis NetworkPolicy has an allow-all peer rule (empty from/to peer list, 0.0.0.0/0 or ::/0 without except, or an empty namespaceSelector with no podSelector); warning for ingress, info for egress

Beyond the shared envelope fields (kind, severity, namespace, kind_of_object, name, reason, message, fingerprint, exempt_reason, exempt_expires):

FieldMeaning
policiesNetworkPolicies in the namespace naming this direction in policyTypes; 0 on a namespace-subject finding, and the number that failed to select the subject on a workload one
total_policiesNetworkPolicies in the namespace in either direction, so an egress-only namespace does not read as an empty one
workloadspod templates in the namespace this claim covers, excluding hostNetwork ones; the finding does not fire at 0
host_network_workloadspod templates excluded because they use the node’s network namespace, where NetworkPolicy does not apply; omitted at 0
covered_workloadspod templates in the namespace that ARE selected for this direction — the neighbours the subject fell out of step with
pod_labelsthe template’s own labels, which are what the policies’ selectors failed to match, sorted and capped at 8
pod_selectorthe dead or allow-all policy’s podSelector, in label-selector syntax
directionthe direction the permissive rule opens (ingress or egress)
policy_typesthe directions the dead policy names, after defaulting an unset policyTypes
namespacessummary note: namespaces examined — the denominator for the namespace-subject claims, which scanned (pod templates) does not cover
skipped_system_namespacessummary note: distinct system namespaces skipped under --skip-system-namespaces

Output: one finding per line (logfmt; —format=json for one JSON object per line), keys in fixed order; healthy resources emit nothing. The final line is always the summary: scanned= findings= elapsed= — findings=0 with a summary present means “scanned and healthy”; a stream without a summary line is void. Exit 0 data, 1 runtime error (diagnostics on stderr only), 2 usage.

Terminal window
lookout audit netpol -A
lookout audit netpol --namespace=prod
lookout audit netpol -A --exemptions=exemptions.yaml --format=json