How to Create a Role in Kubernetes

Create a role in Kubernetes

Planted .

To create a role in Kubernetes, there are two ways.

  1. Create the role config in yaml, then run kubectl create -f
  2. Use the command.

## To create role
kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods

## To create cluster role

kubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods
Updated . Thoughts? Email me.