前言

本文介绍istio的安装及使用

dashboard,grafana,prometheus,kiali,jaeger的配置示例.演示通过istio的ingressgateway统一访问入口

Istio简介

下载istio

  1. https://github.com/istio/istio/releases
  2. wget https://github.com/istio/istio/releases/download/1.2.2/istio-1.2.2-linux.tar.gz
  3. tar xf istio-1.2.2-linux.tar.gz
  4. cd /root/istio-1.2.2
  5. cp bin/istioctl /usr/local/bin/

  

Chart Details

  1. This chart can install multiple Istio components as subcharts:
  2.  
  3. ingressgateway
  4. egressgateway
  5. sidecarInjectorWebhook
  6. galley
  7. mixer
  8. pilot
  9. security(citadel)
  10. grafana
  11. prometheus
  12. tracing(jaeger)
  13. kiali
  14. To enable or disable each component, change the corresponding enabled flag.

  

 

Istio安装

使用helm部署istio服务

安装包内的 Helm 目录中包含了 Istio 的 Chart,官方提供了两种方法:

  • 用 Helm 生成 istio.yaml,然后自行安装。
  • 用 Tiller 直接安装

这里采用第一种方法,通过helm template生成模板文件安装

  1. 注意:最新版本有2部分配置分开的,和之前版本有区别,所有要分别生成配置文件
  2. 生成IstioCRDs
  3. helm template --name istio-init --namespace istio-system ./install/kubernetes/istio-init > istio-init-1.2.2.yaml
  4. 生成istio配置文件
  5. helm template --name istio --namespace istio-system ./install/kubernetes/helm/istio > istio-1.2.2.yaml

以上使用默认配置,有些组件默认是不开启的

vim install/kubernetes/helm/istio/values.yaml

可以手动修改配置文件 修改helm chart默认参数,在生成模板

也可以在命令行添加 --set key=value 覆盖默认值

查看默认参数配置:https://istio.io/docs/reference/config/installation-options/#kiali-options

如下:在命令行直接覆盖默认值:

  1. helm template install/kubernetes/helm/istio --name istio --namespace istio-system --set sidecarInjectorWebhook.enabled=true --set ingress.service.type=NodePort --set gateways.istio-ingressgateway.type=NodePort --set gateways.istio-egressgateway.type=NodePort --set tracing.enabled=true --set servicegraph.enabled=true --set prometheus.enabled=true --set tracing.jaeger.enabled=true --set grafana.enabled=true > istio.yaml
  1. [root@k8s-master istio-1.2.2]# kubectl apply -f istio-init-1.2.2.yaml
  2. configmap/istio-crd-10 created
  3. configmap/istio-crd-11 created
  4. configmap/istio-crd-12 created
  5. serviceaccount/istio-init-service-account created
  6. clusterrole.rbac.authorization.k8s.io/istio-init-istio-system unchanged
  7. clusterrolebinding.rbac.authorization.k8s.io/istio-init-admin-role-binding-istio-system unchanged
  8. job.batch/istio-init-crd-10 created
  9. job.batch/istio-init-crd-11 created
  10. job.batch/istio-init-crd-12 created
  11. [root@k8s-master istio-1.2.2]# kubectl apply -f istio-1.2.2.yaml
  12.  
  13. ###
  14. [root@k8s-master istio-1.2.2]# kubectl get pods -n istio-system
  15. NAME READY STATUS RESTARTS AGE
  16. grafana-6575997f54-2lppn 1/1 Running 0 55m
  17. istio-citadel-894d98c85-644wd 1/1 Running 0 55m
  18. istio-cleanup-secrets-1.2.2-g8568 0/1 Completed 0 55m
  19. istio-galley-5b984f89b-l5prq 1/1 Running 2 55m
  20. istio-grafana-post-install-1.2.2-xcgtb 0/1 Completed 0 55m
  21. istio-ingressgateway-6599d6749-5v9xx 0/1 Running 0 55m
  22. istio-init-crd-10-dfjr2 0/1 Completed 0 59m
  23. istio-init-crd-11-z28bv 0/1 Completed 0 59m
  24. istio-init-crd-12-b9hmw 0/1 Completed 0 59m
  25. istio-pilot-7ccff5dbdc-lhvhm 0/2 Pending 0 55m
  26. istio-policy-77bbfdbd6-rfgsz 2/2 Running 8 55m
  27. istio-security-post-install-1.2.2-tlv6m 0/1 Completed 0 55m
  28. istio-sidecar-injector-7b98dd6bcc-kn7z9 1/1 Running 0 55m
  29. istio-telemetry-7f8d5c5b74-glft4 2/2 Running 8 55m
  30. istio-tracing-555cf644d-g7hsn 1/1 Running 0 55m
  31. kiali-6cd6f9dfb5-trzqx 1/1 Running 0 55m
  32. prometheus-7d7b9f7844-m7ffd 1/1 Running 0 55m
  33. [root@k8s-master istio-1.2.2]#
  34. #使用下面命令验证是否有23istio crds
  35. [root@k8s-master istio-1.2.2]# kubectl get crds | grep 'istio.io\|certmanager.k8s.io' | wc -l
  36. 23
  37. [root@k8s-master istio-1.2.2]#

  

 

Istio使用

gateway和virtualserive配置

  1. [root@k8s-master ~]# cat gateway-istio.yaml
  2. apiVersion: networking.istio.io/v1alpha3
  3. kind: Gateway
  4. metadata:
  5. name: gateway-istio
  6. namespace: istio-system
  7. spec:
  8. selector:
  9. istio: ingressgateway # use istio default controller
  10. servers:
  11. - port:
  12. number: 80
  13. name: http-istio
  14. protocol: HTTP
  15. hosts:
  16. - "prometheus.test.com"
  17. - "kiali.test.com"
  18. - "jaeger.test.com"
  19. - "dashboard.test.com"
  20. - "grafana.test.com"
  21.  
  22. ---
  23.  
  24. apiVersion: networking.istio.io/v1alpha3
  25. kind: VirtualService
  26. metadata:
  27. name: jaeger
  28. namespace: istio-system
  29. spec:
  30. hosts:
  31. - "jaeger.test.com"
  32. gateways:
  33. - gateway-istio
  34. http:
  35. - retries:
  36. attempts: 3
  37. perTryTimeout: 2s
  38. route:
  39. - destination:
  40. host: tracing
  41. port:
  42. number: 80
  43.  
  44. ---
  45. apiVersion: networking.istio.io/v1alpha3
  46. kind: VirtualService
  47. metadata:
  48. name: prometheus
  49. namespace: istio-system
  50. spec:
  51. hosts:
  52. - "prometheus.test.com"
  53. gateways:
  54. - gateway-istio
  55. http:
  56. - retries:
  57. attempts: 3
  58. perTryTimeout: 2s
  59. route:
  60. - destination:
  61. host: prometheus
  62. port:
  63. number: 9090
  64.  
  65. ---
  66. apiVersion: networking.istio.io/v1alpha3
  67. kind: VirtualService
  68. metadata:
  69. name: grafana
  70. namespace: istio-system
  71. spec:
  72. hosts:
  73. - "grafana.test.com"
  74. gateways:
  75. - gateway-istio
  76. http:
  77. - retries:
  78. attempts: 3
  79. perTryTimeout: 2s
  80. route:
  81. - destination:
  82. host: grafana
  83. port:
  84. number: 3000
  85.  
  86. ---
  87. apiVersion: networking.istio.io/v1alpha3
  88. kind: VirtualService
  89. metadata:
  90. name: kiali
  91. namespace: istio-system
  92. spec:
  93. hosts:
  94. - "kiali.test.com"
  95. gateways:
  96. - gateway-istio
  97. http:
  98. - retries:
  99. attempts: 3
  100. perTryTimeout: 2s
  101. route:
  102. - destination:
  103. host: kiali
  104. port:
  105. number: 20001
  106.  
  107. [root@k8s-master ~]#

使用haproxy代理本机80,443端口到k8s集群istio ingressgateway的31380(http)和31390(https)

haproxy配置请看:https://www.cnblogs.com/xuliang666/p/11136829.html

配置域名如下

  1. (base) xuliang@xuliang-PC:~$ cat /etc/hosts
  2. 127.0.0.1 localhost
  3. 127.0.1.1 xuliang-PC
  4.  
  5. # The following lines are desirable for IPv6 capable hosts
  6. ::1 ip6-localhost ip6-loopback
  7. fe00::0 ip6-localnet
  8. ff00::0 ip6-mcastprefix
  9. ff02::1 ip6-allnodes
  10. ff02::2 ip6-allrouters
  11. 10.0.2.51 red.aijiatui.com
  12.  
  13. 192.168.100.29 myapp.test.com
  14. 192.168.100.29 prometheus.test.com
  15. 192.168.100.29 grafana.test.com
  16. 192.168.100.29 kiali.test.com
  17. 192.168.100.29 jaeger.test.com
  18. (base) xuliang@xuliang-PC:~$

 

dashboard配置

查看dashboard svc

  1. [root@k8s-master ~]# kubectl get svc -n kube-system|grep dashboard
  2. kubernetes-dashboard ClusterIP 10.106.65.78 <none> 9090/TCP 27d
  3. [root@k8s-master ~]#

  

创建gateway和virtualservice

  1. #gateway网关配置:
  2. apiVersion: networking.istio.io/v1alpha3
  3. kind: Gateway
  4. metadata:
  5. name: gateway-dashboard
  6. namespace: kube-system
  7. spec:
  8. selector:
  9. istio: ingressgateway # use istio default controller
  10. servers:
  11. - port:
  12. number: 80
  13. name: http-dashboard
  14. protocol: HTTP
  15. hosts:
  16. - "dashboard.test.com"
  17.  
  18. ---
  19. apiVersion: networking.istio.io/v1alpha3
  20. kind: VirtualService
  21. metadata:
  22. name: dashboard
  23. namespace: kube-system
  24. spec:
  25. hosts:
  26. - "dashboard.test.com"
  27. gateways:
  28. - gateway-dashboard
  29. http:
  30. - retries:
  31. attempts: 3
  32. perTryTimeout: 2s
  33. route:
  34. - destination:
  35. host: kubernetes-dashboard
  36. port:
  37. number: 9090

  

在浏览器中输入dashboard.test.com即可访问

jaeger介绍

官网地址:https://www.jaegertracing.io/

Jaeger受Dapper和OpenZipkin的启发,是Uber Technologies公开发布的分布式跟踪系统。它用于监视和排除基于微服务的分布式系统,包括:

  • 分布式上下文传播
  • 分布式事务监控
  • 根本原因分析
  • 服务依赖性分析
  • 性能/延迟优化

访问地址如下:

kiali介绍

服务网格可观察性和配置

官网地址:https://www.kiali.io/

通过helm模板安装完,是没有账户密码的

  1. helm template \
  2. --set kiali.enabled=true \
  3. --set "kiali.dashboard.jaegerURL=http://$(kubectl get svc tracing --namespace istio-system -o jsonpath='{.spec.clusterIP}'):80" \
  4. --set "kiali.dashboard.grafanaURL=http://$(kubectl get svc grafana --namespace istio-system -o jsonpath='{.spec.clusterIP}'):3000" \
  5. install/kubernetes/helm/istio \
  6. --name istio --namespace istio-system > istio.yaml

 

  1. [root@k8s-master ~]# echo -n 'admin' | base64
  2. YWRtaW4=
  3. [root@k8s-master ~]# echo -n 'admin' | base64
  4. YWRtaW4=
  5. [root@k8s-master ~]#
  6.  
  7. [root@k8s-master ~]# cat kiali.yaml
  8. apiVersion: v1
  9. kind: Secret
  10. metadata:
  11. name: kiali
  12. namespace: istio-system
  13. labels:
  14. app: kiali
  15. type: Opaque
  16. data:
  17. username: YWRtaW4K=
  18. passphrase: YWRtaW4K
  19. [root@k8s-master ~]#

或者

  1. USERNAME=$(echo -n 'admin' | base64)
  2. PASSPHRASE=$(echo -n 'admin' | base64)
  3. cat <<EOF | kubectl apply -f -
  4. apiVersion: v1
  5. kind: Secret
  6. metadata:
  7. name: kiali
  8. namespace: $NAMESPACE
  9. labels:
  10. app: kiali
  11. type: Opaque
  12. data:
  13. username: $USERNAME
  14. passphrase: $PASSPHRASE
  15. EOF

查看或修改kiali的配置文件

  1. [root@k8s-master istio-1.2.2]# kubectl get configmap kiali -n istio-system -o yaml
  2. apiVersion: v1
  3. data:
  4. config.yaml: |
  5. istio_namespace: istio-system
  6. auth:
  7. strategy: "login"
  8. server:
  9. port: 20001
  10. web_root: /kiali
  11. external_services:
  12. tracing:
  13. url: http://jaeger.test.com/jaeger
  14. grafana:
  15. url: http://10.100.148.230:3000
  16. prometheus:
  17. url: http://10.109.28.54:9090
  18. kind: ConfigMap
  19. metadata:
  20. annotations:
  21. kubectl.kubernetes.io/last-applied-configuration: |
  22. {"apiVersion":"v1","data":{"config.yaml":"istio_namespace: istio-system\nauth:\n strategy: \"login\"\nserver:\n port: 20001\n web_root: /kiali\nexternal_services:\n tracing:\n url: http://10.100.190.53\n grafana:\n url: http://10.100.148.230:3000\n prometheus:\n url: http://10.109.28.54:9090\n"},"kind":"ConfigMap","metadata":{"annotations":{},"labels":{"app":"kiali","chart":"kiali","heritage":"Tiller","release":"istio"},"name":"kiali","namespace":"istio-system"}}
  23. creationTimestamp: "2019-07-12T06:40:16Z"
  24. labels:
  25. app: kiali
  26. chart: kiali
  27. heritage: Tiller
  28. release: istio
  29. name: kiali
  30. namespace: istio-system
  31. resourceVersion: "1386411"
  32. selfLink: /api/v1/namespaces/istio-system/configmaps/kiali
  33. uid: f2100d5c-05b4-48ca-92c7-73ebea15401e
  34. [root@k8s-master istio-1.2.2]#

注意:

  1. external_services:
  2. tracing:
  3. url: http://10.100.190.53:80
  4. grafana:
  5. url: http://10.100.148.230:3000
  6. prometheus:
  7. url: http://10.109.28.54:9090

 这里的三个地址可以写svc ip也可以写成域名

 

账户:admin  密码:admin

grafana

prometheus

istio1.2.2 安装及使用示例的更多相关文章

  1. Thrift在Windows及Linux平台下的安装和使用示例

    本文章也同时发表在个人博客Thrift在Windows及Linux平台下的安装和使用示例上. thrift介绍 Apache Thrift 是 Facebook 实现的一种高效的.支持多种编程语言的R ...

  2. Redis 安装与简单示例

    Redis 安装与简单示例 一.Redis的安装 Redis下载地址如下:https://github.com/dmajkic/redis/downloads 解压后根据自己机器的实际情况选择32位或 ...

  3. TensorFlow入门,基本介绍,基本概念,计算图,pip安装,helloworld示例,实现简单的神经网络

    TensorFlow入门,基本介绍,基本概念,计算图,pip安装,helloworld示例,实现简单的神经网络

  4. Linux下安装GB2312的示例

    Linux下安装GB2312的示例 Step 1: 到Linux字符集的安装包目录下  [cd /usr/share/i18n/charmaps] Step 2: 解压该目录下的GB2312.gz   ...

  5. cesium安装及第一个示例

    cesium安装及第一个示例 一.环境要求 二.浏览器要求 三.安装node.js 四.下载cesium包(地址为https://cesiumjs.org) 包括了 五.在你的项目里引入相关js与cs ...

  6. istio 安装与bookinfo示例运行

    目的 本文旨在帮助想了解istio安装和运行bookinfo示例的同学快速入门 前置准备 安装k8s和helm 1.k8s安装 修改主机名 hostnamectl set-hostname k8s-m ...

  7. Hadoop:pig 安装及入门示例

    pig是hadoop的一个子项目,用于简化MapReduce的开发工作,可以用更人性化的脚本方式分析数据. 一.安装 a) 下载 从官网http://pig.apache.org下载最新版本(目前是0 ...

  8. Redis 安装与简单示例 01_转

    一.Redis的安装 Redis下载地址如下:https://github.com/dmajkic/redis/downloads 解压后根据自己机器的实际情况选择32位或者64位.下载解压后图片如下 ...

  9. Redis 安装与简单示例 <第一篇>

    一.Redis的安装 Redis下载地址如下:https://github.com/dmajkic/redis/downloads 解压后根据自己机器的实际情况选择32位或者64位.下载解压后图片如下 ...

随机推荐

  1. SSAS表格模型

    Analysis Services 是在决策支持和业务分析中使用的分析数据引擎 (Vertipaq) . 它为商业智能提供企业级语义数据模型功能 (BI) .数据分析和报告应用程序,如 Power B ...

  2. 【知识点】 gcc和g++的联系和区别

    目前(2020-09)GCC 编译器已经更新至 10.2版本,其功能也由最初仅能编译 C 语言,扩增至可以编译多种编程语言,其中就包括 C++ . 除此之外,当下的 GCC 编译器还支持编译 Go.O ...

  3. 实现Hi3559板载自启动网卡、NFS及Telnet服务

    实现Hi3559板载开机自启动网卡.NFS及Telnet服务通过直接在home目录下,编辑.bashrc,vi ~/.bashrc 1 ifconfig eth0 up 2 ifconfig eth0 ...

  4. 剑指 Offer 12. 矩阵中的路径 + 递归 + 深搜 + 字符串问题

    剑指 Offer 12. 矩阵中的路径 题目链接 题目类似于迷宫的搜索. 需要注意的是,需要首先判断起始搜索的位置,可能有多个起点,都需要一一尝试. 每轮迭代的时候记得将是否遍历标记数组还原为未遍历的 ...

  5. Java基础学习--集合

    集合 List集合的特点 1.有序的数据集合,存储元素和取出元素的顺序是一致的(存储123,取出123) 2.有索引,包含了一些带索引的方法 3.允许存储重复的元素 List接口中带索引的方法 add ...

  6. JVM线上问题排查

    前言 本文介绍服务器内运行的 Java 应用产生的 OOM 问题 和 CPU 100% 的问题定位 1. 内存 OOM 问题定位 某Java服务(比如进程id pid 为 3320)出现OOM,常见的 ...

  7. 文件锁fcntl

    一.python中的文件锁 我们在写python应用的时候,当涉及到多个进程向同一个文件write(或者read)的情况,如果几个进程同时都对这个文件进行写操作,那么文件的内容就会变得非常混乱,这个时 ...

  8. python爬取三国演义的所有章节储存到本地文件中

    #爬取三国演义的全部章节 2 3 import urllib 4 import urllib.request 5 import urllib.parse 6 from lxml import etre ...

  9. Linux wget 使用笔记

    wget 是 Linux 上最常用的文件下载工具,简单实用.记录一下一些常用的操作备查. 最常用最简单的操作就是直接使用一个 URL 下载 下载互联网上指定的文件 wget https://gemme ...

  10. 《C++反汇编与逆向分析技术揭秘》--数据类型

      浮点数类型 IEEE标准从逻辑上采用一个三元组{S, E, M}来表示一个数N,它规定基数为2,符号位S用0和1分别表示正和负,尾数M用原码表示,阶码E用移码表示.根据浮点数的规格化方法,尾数域的 ...