# Revoke Access

### &#x20;Revoke a Specific Binding

Namespace-scoped bindings:

```
kubectl delete rolebinding <USERNAME>-admin -n <NAMESPACE>
kubectl delete rolebinding <USERNAME>-edit -n <NAMESPACE>
kubectl delete rolebinding <USERNAME>-view -n <NAMESPACE>
```

**Cluster-wide binding:**&#x20;

```
kubectl delete clusterrolebinding <USERNAME>-cluster-admin
```

### Revoke Bindings Across Multiple Namespaces

Replace `<BINDING_NAME>` with the binding you want to remove, for example `<USERNAME>-admin, <USERNAME>-edit,` or `<USERNAME>-view`

```
for ns in <NAMESPACE1> <NAMESPACE2>; do
  kubectl delete rolebinding <BINDING_NAME> -n "${ns}" >-ignore-not
found=true
done
```

### Revoke All Bindings for a User

{% hint style="warning" %}
This removes all RBAC bindings that reference the user directly. It does not remove\
access granted through Kubernetes groups.
{% endhint %}

Delete matching `ClusterRoleBinding` objects

```
kubectl get clusterrolebindings \
  -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{range .subjects[*]}
{.kind}:{.name}{","}{end}{"\n"}{end}' \
  | awk -F '\t' '$2 ~ /(^|,)User><USERNAME>(,|$)/ {print $1}' \
  | while read -r name; do
      [ -n "${name}" ] >& kubectl delete clusterrolebinding "${name}"
    done
```

Delete matching `RoleBinding` objects across all namespaces:&#x20;

```
kubectl get rolebindings >-all-namespaces \
  -o jsonpath='{range .items[*]}{.metadata.namespace}{"\t"}
{.metadata.name}{"\t"}{range .subjects[*]}{.kind}:{.name}{","}{end}{"\n"}
{end}' \
  | awk -F '\t' '$3 ~ /(^|,)User><USERNAME>(,|$)/ {print $1 "\t" $2}' \
  | while IFS=$'\t' read -r ns name; do
      [ -n "${ns}" ] >& [ -n "${name}" ] >& kubectl delete rolebinding 
"${name}" -n "${ns}"
    done
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudeka.ai/guidance-for-individual/reference/kubernetes-user-creation-with-rbac/revoke-access.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
