首页 > 解决方案 > 用户如何在不访问 Rancher GUI 的情况下获取其 kubeconfig

问题描述

我有一个带有 LDAP 集成的 Rancher 安装。我们的一些用户应该能够使用 kubectl,但不应该能够访问 Rancher web-GUI。如何为这些用户生成 kubeconfig 文件?

通常用户可以在 GUI 中自己获取 kubeconfig 文件,但是如果没有 Rancher GUI 访问,该过程会如何呢?有没有办法用管理员用户生成这些 kubeconfig 文件?

谢谢你的帮助。

标签: kubernetesrancher

解决方案


look here :

get_kubeconfig_custom_cluster_rancher2.sh

Each user is having his own namespace with associated secret. You can get the kubeconfig file as mentionned in the script with something like :

docker exec $CONTID kubectl get secret c-$CLUSTERID -n cattle-system -o json | jq -r .data.cluster | base64 -d | jq -r .metadata.state > kubeconfig

However, this is working only in the case of a local user created by an admin. A ldap/AD user should login one time before having an existing ID.


推荐阅读