- istio部署
在安装 Istio 之前,需要一个运行着 Kubernetes 的兼容版本的 cluster,下载最新版本的istio
[root@master istio]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready master 181d v1.19.1
node01 Ready <none> 181d v1.19.1
node02 Ready <none> 181d v1.19.1
[root@master istio]# pwd
/root/istio
[root@master istio]wget https://github.com/istio/istio/releases/download/1.9.1/istio-1.9.1-linux-amd64.tar.gz
[root@master istio]# tar -zxvf ./*.tar.gz
[root@master istio]# ls
istio-1.9.1 istio-1.9.1-linux-amd64.tar.gz
[root@master istio]# cat /etc/profile|grep istio
export PATH=/root/istio/istio-1.9.1/bin:$JAVA_HOME/bin:$PATH
[root@master istio]# istioctl version
1.9.1
2.选择demo这个profile进行安装
[root@master istio]# istioctl install --set profile=demo -y
✔ Istio core installed
✔ Istiod installed
✔ Egress gateways installed
✔ Ingress gateways installed
✔ Installation complete
[root@master istio]# kubectl get ns,pod -n istio-system
NAME STATUS AGE
namespace/istio-system Active 2m21s
NAME READY STATUS RESTARTS AGE
pod/istio-egressgateway-5d748f86d5-68lnn 1/1 Running 0 2m9s
pod/istio-ingressgateway-67d647b4-8qwh9 1/1 Running 0 2m9s
pod/istiod-596d95bb7-rmwv6 1/1 Running 0 2m17
[root@master istio]# kubectl api-resources |grep istio
[root@master istio]# kubectl get crd
3.安装 dashboard 组件
[root@master samples]# kubectl apply -f ./addons/ -n istio-system
serviceaccount/grafana created
configmap/grafana created
service/grafana created
deployment.apps/grafana created
configmap/istio-grafana-dashboards created
configmap/istio-services-grafana-dashboards created
deployment.apps/jaeger created
service/tracing created
service/zipkin created
service/jaeger-collector created
Warning: apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
serviceaccount/kiali created
configmap/kiali created
deployment.apps/kiali created
monitoringdashboard.monitoring.kiali.io/envoy created
monitoringdashboard.monitoring.kiali.io/go created
monitoringdashboard.monitoring.kiali.io/kiali created
monitoringdashboard.monitoring.kiali.io/micrometer-1.0.6-jvm-pool created
monitoringdashboard.monitoring.kiali.io/micrometer-1.0.6-jvm created
...
deployment.apps/prometheus created
#更改istio-ingressgateway的service类型为NodePort
[root@master samples]# kubectl get svc -n istio-system|grep istio-ingress
istio-ingressgateway LoadBalancer 10.105.176.198 <pending> 15021:32337/TCP,80:30622/TCP,443:30846/TCP,31400:31406/TCP,15443:31706/TCP 10m
[root@master samples]# kubectl patch service istio-ingressgateway -n istio-system -p '{"spec":{"type":"NodePort"}}'
service/istio-ingressgateway patched
[root@master samples]# kubectl get svc -n istio-system|grep istio-ingress
istio-ingressgateway NodePort 10.105.176.198 <none> 15021:32337/TCP,80:30622/TCP,443:30846/TCP,31400:31406/TCP,15443:31706/TCP 12m
4. kiali简单使用
kiali 是一款 istio 服务网格可视化工具,提供了服务拓补图、全链路跟踪、指标遥测、配置校验、健康检查等功能,add-ons组件已包含安装
[root@master samples]# kubectl get pod -n istio-system|grep kiali
kiali-dc84967d9-24qmp 1/1 Running 0 11m
[root@master samples]# kubectl get pod,svc -n istio-system|grep kiali
pod/kiali-dc84967d9-24qmp 1/1 Running 0 11m
service/kiali ClusterIP 10.111.199.157 <none> 20001/TCP,9090/TCP 11m
[root@master samples]# kubectl patch svc -n istio-system kiali -p '{"spec": {"type": "NodePort"}}'
service/kiali patched
#20001端口对应30572
[root@master samples]# kubectl get svc -n istio-system|grep kiali
kiali NodePort 10.111.199.157 <none> 20001:30572/TCP,9090:30889/TCP
#浏览器访问http://nodeip:30572
默认用户名密码是 admin/admin,默认是以anonymous用户登录,不需要用户名和密码