gpt4 book ai didi

reverse-proxy - 具有静态内容的网站的 Istio 配置(特别是 kubevious UI)

转载 作者:行者123 更新时间:2023-12-04 03:51:24 26 4
gpt4 key购买 nike

我正在尝试配置 istio VirtualService 以便我可以通过它打开 kubevious 仪表板( https://github.com/kubevious/kubevious )。
我有以下设置:

resource "kubernetes_manifest" "kubevious" {
provider = kubernetes-alpha

manifest = {
apiVersion = "networking.istio.io/v1alpha3"
kind = "VirtualService"
metadata = {
name = "kubevious"
namespace = "kubevious"
}
spec = {
gateways = [
"istio-system/space-gateway"
]
hosts = [
"*"
]
http = [
{
match = [
{
uri = {
prefix = "/kubevious"
}
}
]
rewrite = {
uri = "/"
}
route = [
{
destination = {
host = "kubevious-ui-svc.kubevious.svc.cluster.local"
}
}
]
},
{
match = [
{
uri = {
prefix = "/static"
}
},
{
uri = {
prefix = "/socket"
}
},
{
uri = {
regex: "^.*\\.(ico|png|jpg)$"
}
}
]
route = [
{
destination = {
host = "kubevious-ui-svc.kubevious.svc.cluster.local"
}
}
]
}
]
}
}
}
kubevious 网站正在打开(尽管有一些我猜与 kubevious 相关的套接字错误)。
我对这种方法有一个问题。如果我想托管更多具有静态内容的网站怎么办?目前,进入 %istio_ingress_ip%/static 的所有内容都将转发到 kubevious。任何其他配置它的方法,即当我调用 %istio_ingress_ip%/kubevious 时,它会将静态内容解析为 %istio_ingress_ip%/kubevious/static?

最佳答案

What if I want to host more websites which have static content?


AFAIK 您应该为此指定主机,而不是 *
例如,假设您有 2 个静态站点,example.com 和 sample.com,然后您在虚拟服务中创建了 2 个主机。
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: example-vs
spec:
hosts:
- example.com <----
http:
- match:
- uri:
prefix: /example
- uri:
prefix: /static
- uri:
prefix: /socket
- uri:
regex: "^.*\\.(ico|png|jpg)$"
route:
- destination:
host: example.default.svc.cluster.local

---

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: sample-vs
spec:
hosts:
- sample.com <----
http:
- match:
- uri:
prefix: /sample
- uri:
prefix: /static
- uri:
prefix: /socket
- uri:
regex: "^.*\\.(ico|png|jpg)$"
route:
- destination:
host: sample.default.svc.cluster.local
其他资源:
  • https://medium.com/@MATT.LAW/istio-and-the-path-to-production-cdb260d58c85

  • Any other way to configure it so that i.e. when I invoke %istio_ingress_ip%/kubevious, it will resolve the static content to %istio_ingress_ip%/kubevious/static?


    关于 istio 中的重写,很少有值得检查的资源。
  • istio: VirtualService rewrite to the root url
  • https://istio.io/latest/docs/reference/config/networking/virtual-service/#HTTPRewrite
  • https://discuss.istio.io/t/rewrite-url-to-the-root-in-the-gateway/2860/3
  • 关于reverse-proxy - 具有静态内容的网站的 Istio 配置(特别是 kubevious UI),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64387083/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com