我正在尝试配置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网站正在打开(尽管有一些套接字错误,我想这些错误与kubevioous有关(。
我对这种方法有一个问题。如果我想托管更多有静态内容的网站怎么办?目前,进入%sistio_ingress_ip%/static的所有内容都将转发到kubevious。是否有其他配置方式,即当我调用%sistio_ingress_ip%/kubevious时,它将把静态内容解析为%istio_ingress _ip%/kubevious/static?
如果我想托管更多具有静态内容的网站怎么办?
AFAIK您应该为此指定主机,而不是*
例如,假设您有两个静态站点,example.com和sample.com,然后在虚拟服务中创建两个主机。
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/@哑光。LAW/istio-and-the-path-to-production-cdb260d58c85
是否有其他配置方式,即当我调用%sistio_ingress_ip%/kubevious时,它会将静态内容解析为%sistio_ngress_ip%\kubevious/static?
关于istio中的重写,几乎没有什么值得检查的资源。
- istio:VirtualService重写到根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