kubectl create role [page]deterministic
Create a role with single rule
##
Create a role with single rule.
``` kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none] ```
##
``` # Create a role named "pod-reader" that allows user to perform "get", "watch" and "list" on pods kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods # Create a role named "pod-reader" with ResourceName specified kubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod # Create a role named "foo" with API Group specified kubectl create role foo --verb=get,list,watch --resource=rs.apps # Create a role named "foo" with SubResource specified kubectl create role foo --verb=get,list,watch --resource=pods,pods/status ```
##
<table style="width: 100%; table-layout: fixed;"> <colgroup> <col span="1" style="width: 10px;" /> <col span="1" /> </colgroup> <tbody>
<tr> <td colspan="2">--allow-missing-template-keys Default: true</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.</p></td> </tr>
<tr> <td colspan="2">--dry-run string[="unchanged"] Default: "none"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.</p></td> </tr>
<tr> <td colspan="2">--field-manager string Default: "kubectl-create"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Name of the manager used to track field ownership.</p></td> </tr>
<tr> <td colspan="2">-h, --help</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>help for role</p></td> </tr>
<tr> <td colspan="2">-o, --output string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Output format. One of: (json, yaml, kyaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).</p></td> </tr>
<tr> <td colspan="2">--resource strings</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Resource that the rule applies to</p></td> </tr>
<tr> <td colspan="2">--resource-name strings</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Resource in the white list that the rule applies to, repeat this flag for multiple items</p></td> </tr>
<tr> <td colspan="2">--save-config</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.</p></td> </tr>
<tr> <td colspan="2">--show-managed-fields</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If true, keep the managedFields when printing objects in JSON or YAML format.</p></td> </tr>
<tr> <td colspan="2">--template string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].</p></td> </tr>
<tr> <td colspan="2">--validate string[="strict"] Default: "strict"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Must be one of: strict (or true), warn, ignore (or false). "true" or "strict" will use a schema t …(trimmed)