proxy-gateway.yaml
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: proxy-gateway
namespace: istio-system
spec:
selector:
app: istio-ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "app.wgs.com"
---
virtualservice-demoapp.yaml
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: proxy
spec:
hosts:
- "app.wgs.com" # 对应于gateways/proxy-gateway
gateways:
- istio-system/proxy-gateway # 相关定义仅应用于Ingress Gateway上
# - mesh # 启用该列表项,意味着该VS同时应用于各Sidecar上
http:
- name: default
route:
- destination:
host: proxy
创建资源
# kubectl apply -f proxy-gateway.yaml -f proxy-virtualservice-proxy.yaml
gateway.networking.istio.io/proxy-gateway created
virtualservice.networking.istio.io/proxy created
查看Istio-ingress-gateway svc EXTERNAL-IP
~# kubectl get svc -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
grafana ClusterIP 10.100.124.243 <none> 3000/TCP 4d19h
istio-egressgateway ClusterIP 10.100.121.95 <none> 80/TCP,443/TCP 4d19h
istio-ingressgateway LoadBalancer 10.100.145.112 192.168.174.250 15021:32417/TCP,80:46683/TCP,443:37652/TCP,31400:59146/TCP,15443:30622/TCP 4d19h
istiod ClusterIP 10.100.149.76 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 4d19h
jaeger-collector ClusterIP 10.100.122.235 <none> 14268/TCP,14250/TCP,9411/TCP 4d19h
kiali ClusterIP 10.100.48.203 <none> 20001/TCP,9090/TCP 4d19h
prometheus ClusterIP 10.100.42.102 <none> 9090/TCP 4d19h
tracing ClusterIP 10.100.92.199 <none> 80/TCP,16685/TCP 4d19h
zipkin ClusterIP 10.100.29.132 <none> 9411/TCP 4d19h
添加域名解析
192.168.174.250 app.wgs.com
访问v10子集
~# while true;do curl app.wgs.com; sleep 0.5; done
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-kdv4m, ServerIP: 172.20.154.244!
- Took 7 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-hq957, ServerIP: 172.20.44.255!
- Took 7 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-kdv4m, ServerIP: 172.20.154.244!
- Took 4 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-hq957, ServerIP: 172.20.44.255!
- Took 7 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-kdv4m, ServerIP: 172.20.154.244!
- Took 9 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-hq957, ServerIP: 172.20.44.255!
- Took 5 milliseconds.
查看kiali
访问v11子集
~# while true;do curl app.wgs.com/canary; sleep 0.5; done
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-sn9qp, ServerIP: 172.20.154.245!
- Took 7 milliseconds.
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-sn9qp, ServerIP: 172.20.154.245!
- Took 5 milliseconds.
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-sn9qp, ServerIP: 172.20.154.245!
- Took 4 milliseconds.
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-sn9qp, ServerIP: 172.20.154.245!
- Took 4 milliseconds.
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-sn9qp, ServerIP: 172.20.154.245!
- Took 11 milliseconds.
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-hckjf, ServerIP: 172.20.89.184!
- Took 6 milliseconds.
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-hckjf, ServerIP: 172.20.89.184!
- Took 7 milliseconds.
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-sn9qp, ServerIP: 172.20.154.245!
- Took 4 milliseconds.
查看kiali
标签:Ingress,ServerName,istio,TCP,Took,demoapp,172.20,milliseconds From: https://www.cnblogs.com/wangguishe/p/16824990.html