首页 > 其他分享 >Istio

Istio

时间:2023-03-21 16:00:41浏览次数:29  
标签:created istio TCP Istio kiali bookinfo k8s

一. Istio安装

1. 下载Istio发布包

wget https://github.com/istio/istio/releases/download/1.17.1/istioctl-1.17.1-osx-arm64.tar.gz

下载成功后,解压安装包:

tar -zxvf istioctl-1.17.1-osx-arm64.tar.gz

将istioctl客户端添加到系统可执行路径
cd istioctl-1.17.1
export PATH=$PWD/bin:$PATH

2. 执行安装istio命令

这里使用istioctl命令执行安装命令,具体如下:

istioctl install --set profile=demo

这里"--set profile=demo"表示安装一个istio测试环境!成功安装后的信息输出如下:

✔ Istio core installed                                                                                                                                                                                                                  
  Processing resources for Istiod. Waiting for Deployment/istio-system/istiod                                                                                                                                                           
- Processing resources for Istiod. Waiting for Deployment/istio-system/istiod                                                                                                                                                           

✔ Istiod installed                                                                                                                                                                                                                      
✔ Ingress gateways installed                                                                                                                                                                                                            
✔ Egress gateways installed                                                                                                                                                                                                             
✔ Installation complete                                                                                                                                                                                                                 Making this installation the default for injection and validation.

安装成功,可以通过kubectl命令查看istio相关组件是否已经安装在Kubernetes环境之中:

ZBMAC-655b32453 k8s-yaml % kubectl get pods  -n istio-system
NAME                                   READY   STATUS    RESTARTS   AGE
istio-egressgateway-774d6846df-95r9t   1/1     Running   0          10m
istio-ingressgateway-69499dc-kgdxk     1/1     Running   0          10m
istiod-65dcb8497-6qrfb                 1/1     Running   0          14m

此时可以看到istio的核心组件istiod,以及入口网关ingressgateway、出口网关egressgateway已经成功以Service资源的方式运行在了Kuberntes集群之中!

3. 默认命名空间开启自动注入EnvoySidecar 

这是一个关键的步骤,如果我们的微服务应用未来是默认部署在k8s的default命名空间,那么在安装istio是需要开启该空间的Sidecar自动注入功能。这是我们前面提到每启动一个微服务应用,k8s就会默认在相同的Pod中自动启动一个代理进程的关键设置!

$ kubectl label namespace default istio-injection=enabled
namespace/default labeled

4. Istio可观测性部署

Kiali是一个基于服务网格的Istio管理控制台,它提供了一些数据仪表盘和可观测能力,同时也可以让我们去操作网格的配置。使用如下方式快速部署一个用于演示的book,命令如下:

% kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml 
service/details created
serviceaccount/bookinfo-details createdapi/                   platform/                      src/                           
deployment.apps/details-v1 created
service/ratings created
serviceaccount/bookinfo-ratings created
deployment.apps/ratings-v1 created
service/reviews created
serviceaccount/bookinfo-reviews created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
service/productpage created
serviceaccount/bookinfo-productpage created
deployment.apps/productpage-v1 created

创建gateway,生成一个gateway的crd

% kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml 
gateway.networking.istio.io/bookinfo-gateway created
virtualservice.networking.istio.io/bookinfo created

 

由于前面安装istio时,我们并没有在istio-system空间开启自动注入Sidecar(其label istio-injection=disabled),这里为了在k8s集群之外正常访问Kiali、Prometheus、Granfana、Tracing的控制面板(它们共同组成了Service Mesh的可观测体系),可以通过nodePort的方式对外暴露端口。

 % kubectl get svc  -n istio-system                                  
NAME                   TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                                                                      AGE
istio-egressgateway    ClusterIP      10.20.107.155   <none>        80/TCP,443/TCP                                                               28m
istio-ingressgateway   LoadBalancer   10.20.16.101    <pending>     15021:31915/TCP,80:31608/TCP,443:31154/TCP,31400:31632/TCP,15443:30874/TCP   28m
istiod                 ClusterIP      10.20.63.74     <none>        15010/TCP,15012/TCP,443/TCP,15014/TCP                                        32m

将LoadBalancer访问修改node访问模式

kubectl edit svc istio-ingressgateway -n istio-system
type: NodePort

 

Kiali是一个基于服务网格的Istio管理控制台,它提供了一些数据仪表盘和可观测能力,同时也可以让我们去操作网格的配置。使用如下方式快速部署一个用于演示的Kiali,命令如下:

istio-1.17.1 %  kubectl apply -f samples/addons
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
serviceaccount/kiali created
configmap/kiali created
clusterrole.rbac.authorization.k8s.io/kiali-viewer created
clusterrole.rbac.authorization.k8s.io/kiali created
clusterrolebinding.rbac.authorization.k8s.io/kiali created
role.rbac.authorization.k8s.io/kiali-controlplane created
rolebinding.rbac.authorization.k8s.io/kiali-controlplane created
service/kiali created
deployment.apps/kiali created
serviceaccount/prometheus created
configmap/prometheus created
clusterrole.rbac.authorization.k8s.io/prometheus created
clusterrolebinding.rbac.authorization.k8s.io/prometheus created
service/prometheus created
deployment.apps/prometheus created

其中具体会安装部署Promethues、Grafana、Zipkin等指标及链路采集服务!因为安装的组件比较多,也比较耗费资源,如果集群资源不是很充足,可能会出现启动比较慢的情况。如果正常部署成功,可以查看Pod状态,命令如下:

istio-1.17.1 % kubectl get pod -n istio-system -o wide
NAME                                   READY   STATUS             RESTARTS   AGE     IP            NODE       NOMINATED NODE   READINESS GATES
grafana-69f9b6bfdc-67n4c               0/1     Running            0          4m40s   10.10.1.227   node01     <none>           <none>
istio-egressgateway-774d6846df-95r9t   1/1     Running            0          40m     10.10.0.194   master01   <none>           <none>
istio-ingressgateway-69499dc-kgdxk     1/1     Running            0          40m     10.10.0.193   master01   <none>           <none>
istiod-65dcb8497-6qrfb                 1/1     Running            0          44m     10.10.0.167   master01   <none>           <none>
jaeger-cc4688b98-lb9z2                 0/1     ImagePullBackOff   0          4m40s   10.10.1.228   node01     <none>           <none>
kiali-594965b98c-spxch                 1/1     Running            0          4m39s   10.10.1.229   node01     <none>           <none>
prometheus-5f84bbfcfd-r4grm            2/2     Running            0          4m38s   10.10.1.230   node01     <none>           <none>

打开控制台

 istioctl dashboard kiali

 

 

 

标签:created,istio,TCP,Istio,kiali,bookinfo,k8s
From: https://www.cnblogs.com/wanghhhh/p/17240038.html

相关文章

  • kubeadm安装kubernetes和istio记录
    周末两天想折腾下k8s和istio学习下。于是用虚拟机搭了一个ubuntu22.04的服务器。国内、国内、国内环境我一开始将ip固定成192.168.50.100了一、使用kubeadm安装单机版的......
  • 基于Istio的灰度发布架构方案实践之路
    作者:京东物流赵勇萍1.背景介绍灰度发布,又名金丝雀发布,是指能够平滑过渡的一种发布方式。基于系统稳定性和快速业务迭代的综合考虑,业务应用开发团队采取了新版本服务灰度上......
  • istio 常见问题解决
    1.Commanderroroutput:xtablesparameterproblem:iptables-restore:unabletoinitializetable'nat'  Failedtoexecute:iptables-restore--noflush/tmp/i......
  • istio 部署案例应用
    1.部署 Bookinfo 示例应用cd/home/istio-1.17.1kubectlapply-fsamples/bookinfo/platform/kube/bookinfo.yamlservice/detailscreatedserviceaccount/bookinf......
  • K8s:渐进式入门服务网格 Istio (一)
    写在前面分享一些Istio的学习笔记博文内容涉及:istio下载安装一个Demo运行什么是istio,服务网格等概念介绍istio架构组成,应用场景等理解不足小伙伴帮忙指......
  • istio在k8s中的部署
    官方github:https://github.com/istio/istio官方部署介绍文档:https://istio.io/latest/zh/docs/setup/getting-started/1.下载istiocurl-Lhttps://istio.io/downloadI......
  • 【ubuntu】请问怎么卸载vmware player 3和vmware worksistion 7啊
    请问怎么卸载vmwareserver和vmwareworksistion啊!!大家不要笑我啊 我现在不知道怎么卸载它们啊我要卸了重装请问怎么卸啊装的时候我都是按默......
  • Istio 升级后踩的坑
    背景前段时间我们将istio版本升级到1.12后导致现有的应用监控有部分数据丢失(页面上显示不出来)。一个是应用基础信息丢失。再一个是应用JVM数据丢失。接口维度......
  • Istio从入门到精通——Istio 架构
    Istio架构https://istio.io/latest/docs/ops/deployment/architecture/Istio服务网格在逻辑上分为 数据平面 和 控制平面。The dataplane iscomposedofa......
  • Istio从入门到精通——Istio Deployment Models
    IstioDeploymentModelshttps://istio.io/latest/docs/ops/deployment/deployment-models/ WhenconfiguringaproductiondeploymentofIstio,youneedtoanswer......