从零到一k8s(八)istio&&service mesh
基础概念 service mesh istio
service mesh
是处理服务间通信的基础设施层。它负责构成现代云原生应用程序的复杂服务拓扑来可靠地交付请求。在实践中,Service Mesh 通常以轻量级网络代理阵列的形式实现,这些代理与应用程序代码部署在一起,对应用程序来说无需感知代理的存在。
istio
通过领先的服务网格简化可观测性,流量管理,安全及策略
基础架构
快速安装入门
点击查看代码
#安装 istio
curl -L https://istio.io/downloadIstio | sh -
cd istio-1.13.2/
./bin/istioctl install --set profile=demo -y
kubectl create ns istio
kubectl label namespace istio istio-injection=enabled
# 部署一个 dome 应用
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml -n istio
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml -n istio
#查看 demo 应用在 ns istio 下是否正常运行
./bin/istioctl analyze -n istio
# 虚拟访问流量
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
curl 10.160.105.6:$INGRESS_PORT/productpage
# 安装kiali 面板工具
kubectl apply -f samples/addons
kubectl rollout status deployment/kiali -n istio-system
#创建 ingress 尝试访问
cat << EOF >kiali-ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kiali
namespace: istio-system
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: kiali.song.test
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: kiali
port:
number: 20001
EOF
kubelet apply -f kiali-ingress