![](/img/trans.png)
[英]How to automatically determine KnownNetworks for ASP.NET Core application running in Kubernetes with an in-cluster reverse proxy?
[英]How to get access to kubernetes cluster from containerized application running inside node hosted on same cluster?
我正在为 c# 使用 kubernetes 客户端库。 理想情况下,此方法应该为我提供它在其中运行的集群的 k8s 配置
var k8sConfig = KubernetesClientConfiguration.InClusterConfig();
在 docker 容器内运行时它给出
k8s.Autorest.HttpOperationException: Operation returned an invalid status code 'Forbidden'
预期的行为是在应用程序内部获取集群,以便使用其配置映射和机密。 是否有任何其他方法可以做到这一点,或者是否有使用此方法的任何先决条件?
请注意:我在集群仪表板中使用 Web UI 的令牌登录
如果你真的想使用 configmap 值,你可以将它挂载到你的 pod 中,如下所示。(秘密相同) https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/然后这些将作为环境变量提供给您的 pod。
https://github.com/kubernetes-client/csharp/discussions/891
我也在github上问过,版主都回答了。 这就是我们需要在这里做的。 牢记“集群绑定”概念。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.