diff --git a/docs/api/workflows/kubeconfigs.md b/docs/api/workflows/kubeconfigs.md index 4170f2b5e8b..9e6a4f0e024 100644 --- a/docs/api/workflows/kubeconfigs.md +++ b/docs/api/workflows/kubeconfigs.md @@ -6,6 +6,18 @@ title: Kubeconfigs +## Kubeconfig Resource + +Kubeconfig is a Rancher resource `kubeconfigs.ext.cattle.io` that allows generating `v1.Config` kubeconfig files for interacting with Rancher and clusters managed by Rancher. + +```sh +kubectl api-resources --api-group=ext.cattle.io +``` + +```sh +kubectl explain kubeconfigs.ext.cattle.io +``` + ## Feature Flag The Kubeconfigs Public API is available since Rancher v2.12.0 and is enabled by default. It can be disabled by setting the `ext-kubeconfigs` feature flag to `false`. @@ -27,7 +39,7 @@ EOF Error from server (Forbidden): error when creating "STDIN": kubeconfigs.ext.cattle.io is forbidden: user system:admin is not a Rancher user ``` -:::note Important: +:::warning Important: The kubeconfig content is generated and returned in the `.status.value` field **only once** when the Kubeconfig is successfully created because it contains secret values for created tokens. Therefore it has to be captured by using an appropriate output options, such as `-o jsonpath='{.status.value}'` or `-o yaml`. diff --git a/shared-files/_glossary.md b/shared-files/_glossary.md index 45d0e6d73fc..b557f00518f 100644 --- a/shared-files/_glossary.md +++ b/shared-files/_glossary.md @@ -159,6 +159,21 @@

Related terms: RKE, RKE2

+
+ Kubeconfig +
+

+ Versions: Rancher v2.12.0 and later +

+
+ A Rancher resource kubeconfigs.ext.cattle.io used to generate kubeconfigs. +
+
+ kubeconfig +
+
+ The kubeconfig file is used to configure access to Kubernetes when used in conjunction with kubectl or other clients. The kubeconfig contents can be generated by creating a Kubeconfig resource. +
## L diff --git a/sidebars.js b/sidebars.js index 6c39c1de6b4..4ac9eb45863 100644 --- a/sidebars.js +++ b/sidebars.js @@ -1356,7 +1356,8 @@ const sidebars = { "type": "category", "label": "Example Workflows", "items": [ - "api/workflows/projects" + "api/workflows/projects", + "api/workflows/kubeconfigs" ] }, "api/api-reference", diff --git a/versioned_docs/version-2.12/api/workflows/kubeconfigs.md b/versioned_docs/version-2.12/api/workflows/kubeconfigs.md new file mode 100644 index 00000000000..9e6a4f0e024 --- /dev/null +++ b/versioned_docs/version-2.12/api/workflows/kubeconfigs.md @@ -0,0 +1,205 @@ +--- +title: Kubeconfigs +--- + + + + + +## Kubeconfig Resource + +Kubeconfig is a Rancher resource `kubeconfigs.ext.cattle.io` that allows generating `v1.Config` kubeconfig files for interacting with Rancher and clusters managed by Rancher. + +```sh +kubectl api-resources --api-group=ext.cattle.io +``` + +```sh +kubectl explain kubeconfigs.ext.cattle.io +``` + +## Feature Flag + +The Kubeconfigs Public API is available since Rancher v2.12.0 and is enabled by default. It can be disabled by setting the `ext-kubeconfigs` feature flag to `false`. + +```sh +kubectl patch feature ext-kubeconfigs -p '{"spec":{"value":false}}' +``` + +## Creating a Kubeconfig + +Only a **valid and active** Rancher user can create a Kubeconfig. +E.g. using a service account `system:admin` will lead to the following error: + +```bash +kubectl create -o jsonpath='{.status.value}' -f -<