kubernetes - 用户如何在不访问 Rancher GUI 的情况下获取其 kubeconfig
问题描述
我有一个带有 LDAP 集成的 Rancher 安装。我们的一些用户应该能够使用 kubectl,但不应该能够访问 Rancher web-GUI。如何为这些用户生成 kubeconfig 文件?
通常用户可以在 GUI 中自己获取 kubeconfig 文件,但是如果没有 Rancher GUI 访问,该过程会如何呢?有没有办法用管理员用户生成这些 kubeconfig 文件?
谢谢你的帮助。
解决方案
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.
推荐阅读
- python - 从 statsmodels 中的 Johansen 协整函数获取 VECM 参数
- sql-server - 如何从 SQL Server 中的存储过程内部授予用户对数据库的访问权限 - 出现错误:过程中不允许使用数据库语句
- spring-boot - java.lang.NoClassDefFoundError: feign/Request$HttpMethod
- r - R:将 API 请求作为参数传递给函数
- javascript - _ context.sent 使用异步函数时未定义,仅在 IE11 中
- php - 将 woocommerce 变体描述添加到购物车中的产品名称以及订单导出
- ffmpeg - 在 .ts 文件调整大小时维护 PTS
- database - 为什么在 Crystal 报表中验证数据库后,存储过程中缺少字段?
- anylogic - 如何调出自定义块的代理类型?
- java - Java:如果文件不存在,我无法为文件是否存在创建条件。为什么?