kubernetes - 动态访问 Kubernetes 命名空间
问题描述
是否可以定义入口,使其指向不同的命名空间。
例如,为不同的客户运行相同的应用程序。命名空间 - Customer1、Customer2
两者都有相同的 api - /api/v1/images/
两者都托管在同一个集群上 - api-dev
现在我们可以根据 api 中的客户名称将流量引导到不同的命名空间,例如
Customer1/api/v1/images/- 将显示存储在 Customer1 命名空间中的图像
Customer2/api/v1/images/- 将显示存储在 Customer2 命名空间中的图像
客户名称将由在默认命名空间中运行的另一个服务提供
解决方案
There are several ways to do this:
You can create a DNS entry per
Service
in each namespace and have each namespace have its own LoadBalancer (perhaps costly but each app can be independently scaled etc)You can use Istio and create a single
Gateway
and create aVirtualServices
to eachNamespace
. This allows one DNS to your cluster and Istio can redirect traffic to each namespace without having to update the cluster DNSYou can write a short CodeZero provisioner for your app (https://github.com/c6o/provisioners) and CodeZero will automatically do the DNS/ingress for each app instance in each namespace. You can test this out using an existing app
推荐阅读
- vue.js - 动态创建 vue 组件
- react-native - 打印反应原生文本和 QR 生成
- java - 在 Android 导航架构中,如何从主机(活动)调用目标片段的方法之一
- javascript - 获取两个元素之间的内容
- java - 授予权限后权限被拒绝
- amazon-web-services - jenkinsfile - 将文件复制到 s3 并公开
- dask - 多个工作流能否在不同的客户端进程中重复使用持久化的 DataFrame?
- azure - IoT DevKit MXChip AZ3166:错误:base64_utility.c(ln 201):长度无效的 Base64 字符串
- python - 如果存在,如何更新列值忽略
- java - 如何从java中的文件中读取每一行