<p>I am trying to create a Role and RoleBinding so I can use Helm. What are the equivelant <code>kubectl</code> commands to create the following resources? Using the command line makes dev-ops simpler in my scenario.</p>

<h2>Role</h2>

<pre><code>kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: tiller-manager-foo
  namespace: foo
rules:
- apiGroups: ["", "batch", "extensions", "apps"]
  resources: ["*"]
  verbs: ["*"]
</code></pre>

<h2>RoleBinding</h2>

<pre><code>kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: tiller-binding-foo
  namespace: foo
subjects:
- kind: ServiceAccount
  name: tiller-foo
  namespace: foo
roleRef:
  kind: Role
  name: tiller-manager-foo
  apiGroup: rbac.authorization.k8s.io
</code></pre>

<h2>Update</h2>

<p>According to @nightfury1204 I can run the following to create the <code>Role</code>:</p>

<blockquote>
  <p>kubectl  create role tiller-manager-foo --namespace foo --verb=* --resource=<em>.,</em>.apps,<em>.batch,</em>
  .extensions -n foo --dry-run -o yaml</p>
</blockquote>

<p>This outputs:</p>

<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  creationTimestamp: null
  name: tiller-manager-foo
rules:
- apiGroups:
  - ""
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - apps
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - batch
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - extensions
  resources:
  - '*'
  verbs:
  - '*'
</code></pre>

<p>The <code>namespace</code> is missing and secondly, is this equivelant?</p>

Muhammad Rehan Saeed
<p><strong>For Role:</strong></p>

<pre><code>kubectl  create role tiller-manager-foo --verb=* --resource=*.batch,*.extensions,*.apps,*. -n foo
</code></pre>

<blockquote>
  <p><code>--resource=*</code> support added on kubectl 1.12 version</p>
</blockquote>

<p><strong>For Rolebinding:</strong></p>

<pre><code>kubectl create rolebinding tiller-binding-foo --role=tiller-manager-foo --serviceaccount=foo:tiller-foo -n foo
</code></pre>
