Authorization of Kubernetes
K8s-authz is a Kubernetes authorization middleware built on Casbin that implements RBAC (Role-Based Access Control) and ABAC (Attribute-Based Access Control) policy enforcement. This middleware integrates with the Kubernetes validation admission webhook to evaluate Casbin-defined policies against each request to Kubernetes resources. Custom admission controllers register with Kubernetes using ValidatingAdmissionWebhook to validate request objects forwarded by the API server and return allow or deny responses.
The validation webhook proxies requests for all Kubernetes resource types and subresources, performing policy verification for each. Users can perform operations on resources only when authorized by the Casbin enforcer. The enforcer evaluates user roles as defined in the policies. Deploy this middleware directly to your Kubernetes cluster.
Prerequisites
Before you begin, ensure you have:
- 正在运行的Kubernetes集群。 Set up a local cluster using Docker or establish a complete Kubernetes environment on your server. For local setup on Windows, see this guide. For Linux server setup, see this tutorial.
- Kubectl CLI。 Installation instructions: Windows | Linux
- OpenSSL