使用 istio ingressgateway 之 nodePort
以http协议为例子
$ kubectl get svc istio-ingressgateway -n istio-system -o yaml | grep -C 5 nodePort
ports:
- name: http2
nodePort: 32586 # 可以使用节点ip+此端口来访问
port: 80
protocol: TCP
targetPort: 8080
也可以这样来获取:
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
echo $INGRESS_PORT
使用 istio ingressgateway 之 externalIPs
$ kubectl edit svc istio-ingressgateway -n istio-system
修改spec下的内容, 增加 externalIPs,...
spec:
externalIPs: # 增加的内容
- 192.168.3.4 # 增加的内容
- aa.bb.cc.dd # 需要增加的ip
allocateLoadBalancerNodePorts: true
clusterIP: 10.96.32.201
如果你的 istio-ingressgateway 显示状态是<pending>
, 那么很可能是你不在公有云环境, 这里需要像上面一样手动kubectl edit...
$ kubectl get svc -n istio-system | grep istio-ingressgateway
istio-ingressgateway LoadBalancer 10.96.32.201 <pending> 15021:32678/TCP 省略...
参考
欢迎补充指正!