Kubernetes operator security
Locks down Kubernetes operators with least privilege RBAC, CRD and pod rules, so they are not an easy way in.
What we improved
Added how to fix each problem, not only what to check: a least-privilege RBAC section with kubebuilder RBAC markers and `controller-gen`, a namespaced Role for leader election, controller-runtime cache scoping so the operator does not need
Improved by YourAISkill from the original by RedHatProductSecurity, under its Apache-2.0 licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.
Claude's review
8/10 Concrete least-privilege RBAC, CRD and pod security rules for Kubernetes operators with kubebuilder markers, cache scoping, audit jq queries and a certsuite mapping.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Enforce least-privilege RBAC and secure runtime configuration for Kubernetes Operators. Use when building, reviewing, or auditing Operator manifests, ClusterRoles, Roles, OLM bundles, or CRD definitions.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: operator-security
description: >
Enforce least-privilege RBAC and secure runtime configuration for Kubernetes
Operators, with concrete fixes. Use when building, reviewing, or auditing
Operator manifests, ClusterRoles and Roles, kubebuilder RBAC markers, OLM
bundles (CSV permissions, OperatorGroups, skip ranges), CRD definitions, or
operator and operand security contexts, or when preparing an operator for the
Red Hat Best Practices certsuite operator tests.
category: "secure_development"
subcategory: "kubernetes"
---
<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by RedHatProductSecurity. See CHANGES.md. -->
# Kubernetes Operator Security
Secure Operator manifests, OLM packaging, CRD governance, and runtime configuration for least-privilege operation. An operator is a privileged controller that acts on behalf of anyone who can create its custom resources, so its permissions, and what its CRDs let users ask for, are the attack surface.
## How to use this skill
- **Building:** generate RBAC from kubebuilder markers, scope the manager's cache, ship the security contexts below, and package with the OLM settings in the requirements table.
- **Reviewing:** read the CSV (`spec.install.spec.clusterPermissions` and `permissions`), `config/rbac/*.yaml`, the manager Deployment, the CRD schemas, and the code that turns a custom resource into operand pods. Report each finding with the rule it breaks, its impact, and the fix.
- **Auditing a live cluster:** run the commands in "Verify on a cluster", then work through the checklist.
## Design Principles
### Minimize scope
- Restrict cluster-scope and namespace-scope permissions to the minimum required for the operator to function.
- Justify every cluster-scoped permission. Ship static cluster-scoped objects (ClusterRoles for operands, CRDs, PriorityClasses) in the OLM bundle so the operator never needs `create` on them at runtime.
- Use an `OperatorGroup` to set the namespaces the operator manages, and support the narrowest install mode you can (`OwnNamespace` or `SingleNamespace` before `AllNamespaces`).
- Know what OLM does with your namespaced `permissions`: it creates them in each namespace the OperatorGroup targets, and for an `AllNamespaces` OperatorGroup it grants them cluster-wide. Supporting `AllNamespaces` therefore turns every namespaced permission into a cluster permission.
```yaml
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: my-operator
namespace: my-operator-system
...From RedHatProductSecurity's repository, Apache-2.0 licence.
Related skills
-
Checked
Codebase quality audit
Audits a whole code repo for bugs, security holes, slow paths and dead code, ranked in plain English.
7/101 credit -
Checked
Security and CVE audit
Runs a security and CVE audit on code in any language and scores it out of 100, with false alarms filtered.
7/101 credit -
Checked
OWASP code review
Reviews code for security flaws using the latest OWASP Top 10 lists, including those for AI and agent apps.
7/101 credit -
Checked
Code security hardening
Hardens code that handles user input, logins and data against the OWASP Top 10, starting from a threat model.
7/101 credit -
Checked
Secure web backend code
Writes and reviews login, access control and input handling for web backends, so common attacks are blocked.
8/101 credit -
Checked
Android intent security
Audits Android components and incoming intents to fix redirection and unauthorised access holes in your app.
8/101 credit