gpt4 book ai didi

kubernetes - Istio VirtualService 和 Kubernetes Service 有什么区别?

转载 作者:行者123 更新时间:2023-12-04 12:16:12 35 4
gpt4 key购买 nike

据我了解,Istio VirtualService是一种抽象的东西,它试图在实际实现中添加一个接口(interface),比如 Kubernetes 中的服务或 Consul 中的类似东西。
当使用 Kubernetes 作为 Istio 的底层平台时,Istio VirtualService 和 Istio 有什么区别吗?和 Kubernetes Service还是一样?

最佳答案

Kubernetes 服务
Kubernetes service管理 pod 的网络。它指定您的 pod 是在内部(ClusterIP)、外部(NodePortLoadBalancer)还是作为其他 DNS 条目的 CNAME(externalName)公开。
foo-service 为例将暴露带有标签 app: foo 的 pod .发送到端口 30007 上的节点的任何请求将被转发到端口 80 上的 pod .

apiVersion: v1
kind: Service
metadata:
name: foo-service
spec:
type: NodePort
selector:
app: foo
ports:
- port: 80
targetPort: 80
nodePort: 30007
Istio 虚拟服务
Istio virtualservice比 Kuberenetes service 高一级.它可用于对 services 应用流量路由、故障注入(inject)、重试和许多其他配置.
foo-retry-virtualservice 为例对于对 foo 的失败请求,将重试 3 次,每次超时 2 秒。 .
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: foo-retry-virtualservice
spec:
hosts:
- foo
http:
- route:
- destination:
host: foo
retries:
attempts: 3
perTryTimeout: 2s
另一个例子 foo-delay-virtualservice将对 foo 的 0.1% 的请求应用 0.5 秒的延迟.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: foo-delay-virtualservice
spec:
hosts:
- foo
http:
- fault:
delay:
percentage:
value: 0.1
fixedDelay: 5s
route:
- destination:
host: foo
引用
https://kubernetes.io/docs/concepts/services-networking/service/
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
https://istio.io/latest/docs/reference/config/networking/virtual-service/
https://istio.io/latest/docs/concepts/traffic-management/#virtual-services

关于kubernetes - Istio VirtualService 和 Kubernetes Service 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53743219/

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