istio命令
网格中每个 Envoy 的同步状态
istioctl proxy-status
istioctl ps
从Envoy检索有关代理配置的信息(proxu-config)
istioctl pc listener sleep-698cfc4445-knqgn
按端口筛选
istioctl pc listener --port=8080 sleep-698cfc4445-knqgn
查看路由配置
istioctl pc routes sleep-698cfc4445-knqgn
查看集群配置
istioctl pc clusters sleep-698cfc4445-knqgn
查看后端端点
istioctl pc endpoints sleep-698cfc4445-knqgn | grep demoappv10
创建一个gateway
[root@k8s-master tmp]# cat demoapp-gateway.yaml
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: demoapp-gateway
namespace: istio-system # 要指定为ingress gateway pod所在名称空间
spec:
selector:
app: istio-ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "demoap.magedu.com"
查看
kubectl get gw -n istio-system
kubectl get gw -n istio-system
kubectl describe svc istio-ingressgateway -n istio-system
istioctl pc routes istio-ingressgateway-55b6cffcbc-6nll2 -n istio-system
创建一个vs
kubectl appply -f /tmp/virtualservice-demoapp.yaml
[root@k8s-master ~]# cat /tmp/virtualservice-demoapp.yaml
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: demoapp
spec:
hosts:
- "demoap.magedu.com" # 对应于gateways/proxy-gateway
gateways:
- istio-system/demoapp-gateway # 相关定义仅应用于Ingress Gateway上
#- mesh
http:
- name: default
route:
- destination:
host: demoappv10
查看vs,可以看到将demoap.magedu.com已经关联到了istio-system ns的demoapp-gateway
kubectl get vs
查看路由可以看到8080端口已经路由到了demoap.magedu.com
istioctl pc routes istio-ingressgateway-55b6cffcbc-6nll2 -n istio-system
之后自己做一个域名解析 浏览器访问测试下