⎈ k8s knowledge compiler

kubectl config set [page]deterministic

Set an individual value in a kubeconfig file

reference

##

Set an individual value in a kubeconfig file.

PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.

PROPERTY_VALUE is the new value you want to set. Binary fields such as 'certificate-authority-data' expect a base64 encoded string unless the --set-raw-bytes flag is used.

Specifying an attribute name that already exists will merge new fields on top of existing values.

``` kubectl config set PROPERTY_NAME PROPERTY_VALUE ```

##

``` # Set the server field on the my-cluster cluster to https://1.2.3.4 kubectl config set clusters.my-cluster.server https://1.2.3.4 # Set the certificate-authority-data field on the my-cluster cluster kubectl config set clusters.my-cluster.certificate-authority-data $(echo "cert_data_here" | base64 -i -) # Set the cluster field in the my-context context to my-cluster kubectl config set contexts.my-context.cluster my-cluster # Set the client-key-data field in the cluster-admin user using --set-raw-bytes option kubectl config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true ```

##

<table style="width: 100%; table-layout: fixed;"> <colgroup> <col span="1" style="width: 10px;" /> <col span="1" /> </colgroup> <tbody>

<tr> <td colspan="2">-h, --help</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>help for set</p></td> </tr>

<tr> <td colspan="2">--set-raw-bytes tristate[=true]</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>When writing a []byte PROPERTY_VALUE, write the given string directly without base64 decoding.</p></td> </tr>

</tbody> </table>

##

<table style="width: 100%; table-layout: fixed;"> <colgroup> <col span="1" style="width: 10px;" /> <col span="1" /> </colgroup> <tbody>

<tr> <td colspan="2">--as string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Username to impersonate for the operation. User could be a regular user or a service account in a namespace.</p></td> </tr>

<tr> <td colspan="2">--as-group strings</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Group to impersonate for the operation, this flag can be repeated to specify multiple groups.</p></td> </tr>

<tr> <td colspan="2">--as-uid string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>UID to impersonate for the operation.</p></td> </tr>

<tr> <td colspan="2">--as-user-extra strings</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>User extras to impersonate for the operation, this flag can be repeated to specify multiple values for the same key.</p></td> </tr>

<tr> <td colspan="2">--cache-dir string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "$HOME/.kube/cache"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Default cache directory</p></td> </tr>

<tr> <td colspan="2">--certificate-authority string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Path to a cert file for the certificate authority</p></td> </tr>

<tr> <td colspan="2">--client-certificate string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Path to a client certificate file for TLS</p></td> </tr>

<tr> <td colspan="2">--client-key string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Path to a client key file for TLS</p></td> </tr>

<tr> <td colspan="2">--cluster string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>The name of the kubeconfig cluster to use</p></td> </tr>

<tr> <td colspan="2">--context string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>The name of the kubeconfig context to use</p></td> </tr>

<tr> <td colspan="2">--disable-compression</td> </tr> <tr> <td></td><td style="line-heig …(trimmed)

Sources

reference/kubectl/generated/kubectl_config/kubectl_config_set.md · dockubectl config set

Related (5)

part_of {{% heading "synopsis" %}}describes conf=1
part_of {{% heading "examples" %}}describes conf=1
part_of {{% heading "options" %}}describes conf=1
part_of {{% heading "parentoptions" %}}describes conf=1
part_of {{% heading "seealso" %}}describes conf=1

← all Docs