istio

本次安装的Istio版本为v1.12.0。

在master节点执行以下命令进行Istio服务网格环境的安装:

[root@k8s-master-node1 ~]# kubeeasy add --istio istio

查看Pod:

[root@k8s-master-node1 ~]# kubectl -n istio-system get pods
NAME                                 READY  STATUS   RESTARTS  AGE
grafana-6ccd56f4b6-twwjv              1/1    Running  0        5m15s
istio-egressgateway-7f4864f59c-nxz2l  1/1    Running  0        5m34s
istio-ingressgateway-55d9fb9f-jzhnb   1/1    Running  0        5m34s
istiod-555d47cb65-jwkgp               1/1    Running  0        5m40s
jaeger-5d44bc5c5d-h9t29               1/1    Running  0        5m15s
kiali-79b86ff5bc-v9sfk                1/1    Running  0        5m15s
prometheus-64fd8ccd65-5px64           2/2    Running   0       5m15s

查看Istio版本信息:

[root@k8s-master-node1 ~]# istioctl version
client version: 1.12.0
control plane version: 1.12.0
data plane version: 1.12.0 (2 proxies)
3.2 Istio可视化

访问Grafana(http://master_IP:33000),如图5所示:

图5 Grafana访问界面

访问Prometheus(http://master_IP:30090),如图6所示:

图6访问Prometheus

查看Targets,如图7所示:

图7查看Targets

访问Jaeger(http://master_IP:30686),如图所示:

图8访问Jaeger

访问Kiali(http://master_IP:20001),如图9所示:

图9访问Kiali

3.3 istioctl基本使用

istioctl用于在Istio系统中创建、列出、修改以及删除配置资源。

可用的路由和流量管理配置类型有virtualservice、gateway、destinationrule、serviceentry、httpapispec、httpapispecbinding、quotaspec、quotaspecbinding、servicerole、servicerolebinding、policy。

使用下面命令展示istioctl可以访问到的Istio配置档的名称:

# istioctl profile list
Istio configuration profiles:
    default
    demo
    empty
    external
    minimal
    openshift
    preview
    remote

展示配置档的配置信息:

# istioctl profile dump demo

显示配置文件的差异:

# istioctl profile diff default demo

可以使用proxy-status或ps命令概览服务网格:

# istioctl proxy-status

如果输出列表中缺少某个代理,则意味着它当前未连接到Polit实例,所以它无法接收到任何配置。此外,如果它被标记为stale,则意味着存在网络问题或者需要扩展Pilot。

istioctl允许使用proxy-config或者pc命令检索代理的配置信息。

检索特定Pod中Envoy实例的集群配置的信息:

# istioctl proxy-config cluster  [flags]

检索特定Pod中Envoy实例的bootstrap配置的信息:

# istioctl proxy-config bootstrap  [flags]

检索特定Pod中Envoy实例的监听器配置的信息:

# istioctl proxy-config listener  [flags]

检索特定Pod中Envoy实例的路由配置的信息:

# istioctl proxy-config route  [flags]

检索特定Pod中Envoy实例的endpoint配置的信息:

# istioctl proxy-config endpoints  [flags]
3.4 istioctl基础案例

在Kubernetes集群上完成Istio服务网格环境的安装,然后新建命名空间exam,为该命名空间开启自动注入Sidecar:

# kubectl create namespace exam
# kubectl label namespace exam istio-injection=enabled

在master节点执行kubectl -n istio-system get all命令和kubectl get ns exam --show-labels命令进行验证:

# kubectl -n istio-system get all
NAME                                       READY   STATUS    RESTARTS   AGE
pod/grafana-6ccd56f4b6-ssmbl               1/1     Running   0          81s
pod/istio-egressgateway-7f4864f59c-qm7wn   1/1     Running   0          97s
pod/istio-ingressgateway-55d9fb9f-jd4pn    1/1     Running   0          97s
pod/istiod-555d47cb65-p5cmq                1/1     Running   0          104s
pod/jaeger-5d44bc5c5d-xqvbj                1/1     Running   0          81s
pod/kiali-9f9596d69-2wsjl                  1/1     Running   0          80s
pod/prometheus-64fd8ccd65-w2zrg            2/2     Running   0          80s
......
# kubectl get ns exam --show-labels
NAME   STATUS   AGE   LABELS
exam   Active   28s   istio-injection=enabled

你可能感兴趣的:(istio)