<p>I'm currently using <code>kubectl create -f clusterRole.yaml</code> , I was wondering if I can use helm to install it automatically with my chart.</p>
<p>I was looking at the helm documentation, and it used <code>kubectl create -f</code> for the clusterRole file. Is there any reason that this can't be done through helm? Is it because this concerns with  access privilege issues?</p>

allen
<p>As already mentioned in the comments, you can install your RBAC roles using your helm chart. As a matter of fact many of the helm charts do configure roles/clusterRoles at install. Here's an example of Elasticsearch <a href="https://github.com/elastic/helm-charts/blob/master/elasticsearch/templates/role.yaml" rel="nofollow noreferrer">helm chart</a> which does configure <code>Role</code> and <code>RoleBinding</code> at install level:</p>
<pre class="lang-yaml prettyprint-override"><code>{{- if .Values.rbac.create -}}
{{- $fullName := include &quot;elasticsearch.uname&quot; . -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ $fullName | quote }}
  labels:
    heritage: {{ .Release.Service | quote }}
    release: {{ .Release.Name | quote }}
    chart: &quot;{{ .Chart.Name }}-{{ .Chart.Version }}&quot;
    app: {{ $fullName | quote }}
rules:
  - apiGroups:
      - extensions
    resources:
      - podsecuritypolicies
    resourceNames:
      {{- if eq .Values.podSecurityPolicy.name &quot;&quot; }}
      - {{ $fullName | quote }}
      {{- else }}
      - {{ .Values.podSecurityPolicy.name | quote }}
      {{- end }}
    verbs:
      - use
{{- end -}}
</code></pre>
<p>Another example with clusterRole can be found <a href="https://raw.githubusercontent.com/helm/charts/master/stable/kube2iam/templates/clusterrole.yaml" rel="nofollow noreferrer">here</a>.</p>
<p>To sum up, if you context allow you to install desired rbac or any other stuff with <code>kubectl</code> then basically you will be able to do so with helm.</p>
