How can we delete existing role in kubernetes?
Asked Answered
M

2

8

Is there a way to delete existing role in kubernetes? I have made a mistake while creating roles for the users and now I want to update or delete the role. Please let me know a way

Mayence answered 20/2, 2020 at 16:9 Comment(0)
Z
23

Delete a Role:

kubectl delete role NAME_OF_ROLE -n NAMESPACE

Delete RoleBinding:

kubectl delete rolebinding NAME_OF_ROLEBINDING -n NAMESPACE

Update Role:

kubectl apply -f NEW_YAML_FILE_FOR_ROLE

Update RoleBInding:

kubectl apply -f NEW_YAML_FILE_FOR_ROLEBINDING

Ziagos answered 20/2, 2020 at 16:16 Comment(0)
T
5
kubectl get clusterroles
kubectl get clusterrolebindings
find your role name and then delete
kubectl delete clusterrolebinding name
kubectl delete clusterrole name

courtesy : https://forum.linuxfoundation.org/discussion/858217/lab-10-1-how-to-delete-a-clusterrole-and-a-clusterrolebinding

Thrash answered 8/9, 2022 at 17:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.