Dolphin
Dolphin

Reputation: 39075

how to edit kubernetes cluster role define

I have created a cluster role yaml(rbac.yaml) like this:

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: traefik-ingress-controller
rules:
  - apiGroups: [""]
    resources: ["services","endpoints","secrets"]
    verbs: ["get","list","watch"]
  - apiGroups: ["extensions"]
    resources: ["ingresses"]
    verbs: ["get","list","watch"]

Now I want to add a new apiGroups into the ClusterRole.

How to edit the ClusterRole and refresh? I search from kubernetes docs,but nothing to tell how to edit.what should I do to update the yaml?

Upvotes: 0

Views: 3647

Answers (1)

Arghya Sadhu
Arghya Sadhu

Reputation: 44687

You just need to modify the yaml and apply it again. Kubernetes API Server will take care of updating it into ETCD storage and it should take effect almost immediately.

You can also edit in directly via kubectl edit clusterrole clustebrolename but I don't recommend that because you loose the previous history. You should really be version controlling your yamls and apply the changes with kubectl apply

Upvotes: 2

Related Questions