下载istio
1.下载安装包
wget https://github.com/istio/istio/releases/download/1.11.0/istio-1.11.0-linux-amd64.tar.gz
2.解压
tar -zxf istio-1.11.0-linux-amd64.tar.gz
3.加入环境变量
vim /etc/profile.d/istio.sh
#添加如下代码
ISTIO_HOME=/home/lichuanzhang/workspace/istio/istio-1.11.0
export PATH=$PATH:$ISTIO_HOME/bin
#保存并退出 刷新配置使其生效
source /etc/profile
安装istio
istioctl install --set profile=demo -y
✔ Istio core installed
✔ Istiod installed
✔ Egress gateways installed
✔ Ingress gateways installed
✔ Installation complete
安装demo应用
#创建命名空间
kubectl create namespace bookinfo-ns
#给定命名空间自动注入 Envoy 边车代理
kubectl label namespace bookinfo-ns istio-injection=enabled
#启动demo:
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml -n bookinfo-ns
#查看部署信息;
kubectl get service -n bookinfo-ns
kubectl get pods -n bookinfo-ns
对外开放应用程序
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml -n bookinfo-ns
确定入站的ip和端口
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n istio-system -o jsonpath='{.items[0].status.hostIP}')
export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT
#获取访问地址
echo "http://$GATEWAY_URL/productpage"
安装istio的dashboard
- 安装 Kiali 和其他插件,等待部署完成。
kubectl apply -f samples/addons
kubectl rollout status deployment/kiali -n istio-system
2.访问 Kiali 仪表板。
$ istioctl dashboard kiali
