需求

搭建istio基础环境(基于1.5.1版本)

安装步骤

在安装 Istio 之前,需要一个运行着 Kubernetes 的环境,安装步骤可以参考前面的文章

下载istio,然后解压,然后将 istioctl 增加到 path 环境变量中

curl -L https://istio.io/downloadIstio | sh -
cd istio-1.5.1
export PATH=$PWD/bin:$PATH

新建istio-1.5.1.yaml 配置文件、按照官方文档操作安装会出现错误,导致不能正常进行sidecar 自动注入

vim istio-1.5.1.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
components:
egressGateways:
- name: istio-egressgateway
enabled: true
k8s:
resources:
requests:
cpu: 10m
memory: 40Mi ingressGateways:
- name: istio-ingressgateway
enabled: true
k8s:
resources:
requests:
cpu: 10m
memory: 40Mi
service:
ports:
## You can add custom gateway ports in user values overrides, but it must include those ports since helm replaces.
# Note that AWS ELB will by default perform health checks on the first port
# on this list. Setting this to the health check port will ensure that health
# checks always work. https://github.com/istio/istio/issues/12503
- port: 15020
targetPort: 15020
name: status-port
- port: 80
targetPort: 8080
name: http2
- port: 443
targetPort: 8443
name: https
- port: 31400
targetPort: 31400
name: tcp
# This is the port where sni routing happens
- port: 15443
targetPort: 15443
name: tls policy:
enabled: false
k8s:
resources:
requests:
cpu: 10m
memory: 100Mi telemetry:
k8s:
resources:
requests:
cpu: 50m
memory: 100Mi pilot:
k8s:
env:
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: GODEBUG
value: gctrace=1
- name: PILOT_TRACE_SAMPLING
value: "100"
- name: CONFIG_NAMESPACE
value: istio-config
resources:
requests:
cpu: 10m
memory: 100Mi addonComponents:
kiali:
enabled: true
grafana:
enabled: true
tracing:
enabled: true
prometheus:
enabled: true values:
global:
disablePolicyChecks: false
proxy:
accessLogFile: /dev/stdout
includeIPRanges: 192.168.16.0/20,192.168.32.0/20
autoInject: enabled #配置自动注入
resources:
requests:
cpu: 10m
memory: 40Mi
sidecarInjectorWebhook:
enableNamespacesByDefault: true pilot:
autoscaleEnabled: false mixer:
adapters:
useAdapterCRDs: false
kubernetesenv:
enabled: true
prometheus:
enabled: true
metricsExpiryDuration: 10m
stackdriver:
enabled: false
stdio:
enabled: true
outputAsJson: false
policy:
autoscaleEnabled: false
telemetry:
autoscaleEnabled: false gateways:
istio-egressgateway:
autoscaleEnabled: true
istio-ingressgateway:
autoscaleEnabled: true
kiali:
createDemoSecret: true

安装对应配置

istioctl manifest apply -f istio-1.5.1.yaml

验证是否安装成功

kubectl get svc -n istio-system

NAME                        TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                                                                      AGE
grafana ClusterIP 10.106.222.1 <none> 3000/TCP 72m
istio-egressgateway ClusterIP 10.105.147.175 <none> 80/TCP,443/TCP,15443/TCP 72m
istio-ingressgateway LoadBalancer 10.101.90.130 <pending> 15020:31121/TCP,80:31729/TCP,443:31903/TCP,31400:32746/TCP,15443:31084/TCP 72m
istio-pilot ClusterIP 10.101.28.124 <none> 15010/TCP,15011/TCP,15012/TCP,8080/TCP,15014/TCP,443/TCP 80m
istiod ClusterIP 10.99.35.177 <none> 15012/TCP,443/TCP 80m
jaeger-agent ClusterIP None <none> 5775/UDP,6831/UDP,6832/UDP 72m
jaeger-collector ClusterIP 10.109.237.212 <none> 14267/TCP,14268/TCP,14250/TCP 72m
jaeger-collector-headless ClusterIP None <none> 14250/TCP 72m
jaeger-query ClusterIP 10.103.4.63 <none> 16686/TCP 72m
kiali ClusterIP 10.100.49.221 <none> 20001/TCP 72m
prometheus ClusterIP 10.110.124.176 <none> 9090/TCP 72m
tracing ClusterIP 10.106.75.109 <none> 80/TCP 72m
zipkin ClusterIP 10.103.9.94 <none> 9411/TCP

确保关联的 Kubernetes pod 已经部署,并且 STATUSRunning

kubectl get pods -n istio-system

NAME                                    READY   STATUS    RESTARTS   AGE
grafana-5f6f8cbf75-trjl6 1/1 Running 0 73m
istio-egressgateway-74896c8487-9qnwg 1/1 Running 0 73m
istio-ingressgateway-56f7dd5d6b-9c22z 1/1 Running 0 73m
istio-tracing-9dd6c4f7c-qr7vl 1/1 Running 0 73m
istiod-756bd84654-fqp7b 1/1 Running 0 73m
istiod-756bd84654-hxpqt 1/1 Running 0 73m
kiali-869c6894c5-p4h7r 1/1 Running 0 73m
prometheus-c89875c74-lvq52 2/2 Running 0 73m

卸载istio

istioctl manifest generate --set profile=demo | kubectl delete -f -

部署Bookinfo

Istio 默认自动注入 Sidecar. 请为 default 命名空间打上标签 istio-injection=enabled

kubectl label namespace default istio-injection=enabled

使用 kubectl 部署应用:

kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml

在实际部署中,微服务版本的启动过程需要持续一段时间,并不是同时完成的。

确认所有的服务和 Pod 都已经正确的定义和启动:

kubectl get services
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
details 10.0.0.31 <none> 9080/TCP 6m
kubernetes 10.0.0.1 <none> 443/TCP 7d
productpage 10.0.0.120 <none> 9080/TCP 6m
ratings 10.0.0.15 <none> 9080/TCP 6m
reviews 10.0.0.170 <none> 9080/TCP 6m
kubectl get pods
NAME READY STATUS RESTARTS AGE
details-v1-1520924117-48z17 2/2 Running 0 6m
productpage-v1-560495357-jk1lz 2/2 Running 0 6m
ratings-v1-734492171-rnr5l 2/2 Running 0 6m
reviews-v1-874083890-f0qf0 2/2 Running 0 6m
reviews-v2-1343845940-b34q5 2/2 Running 0 6m
reviews-v3-1813607990-8ch52 2/2 Running 0 6m

确认 Bookinfo 应用是否正在运行,请在某个 Pod 中用 curl 命令对应用发送请求,例如 ratings

kubectl exec -it $(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}') -c ratings -- curl productpage:9080/productpage | grep -o "<title>.*</title>"
<title>Simple Bookstore App</title>

使用浏览器访问Bookinfo放在后面来讲解,因为是使用云环境而非本地,使用gateway/ingress开放外网端口还需要调整一些配置,跟官方文档在本地安装还有些差异。

参考文献

https://preliminary.istio.io/zh/docs/setup/getting-started/

搭建Istio基础环境的更多相关文章

  1. 搭建SSM基础环境>基于idea

    目录 搭建SSM基础环境 创建一个Web项目 导入所需要的jar包 在项目目录下创建一个Resources文件夹并设置为类路径 在src目录下创建项目的初始文件夹目录 在resources文件夹下创建 ...

  2. centos7搭建Fabric基础环境

    一.首先升级centos最新内核 参考https://www.cnblogs.com/sky-cheng/p/12146054.html 二.卸载旧版本docker [root@localhost ~ ...

  3. 2-10 就业课(2.0)-oozie:12、cm环境搭建的基础环境准备

    8.clouderaManager5.14.0环境安装搭建 Cloudera Manager是cloudera公司提供的一种大数据的解决方案,可以通过ClouderaManager管理界面来对我们的集 ...

  4. shell搭建CentOS_7基础环境

    #!/bin/bash#Auth:Darius#CentOS_7配置实验环境eno=`ifconfig|awk '{print $1}'|head -1|awk -F ":" '{ ...

  5. 20190228 搭建Hadoop基础环境

    下载VMware 12 版本以上 下载CentOS 7以上版本 安装虚拟机,安装系统时,注意设置root 账号和密码 虚拟机配置网络,命令ip addr 查看IP 地址,(配置网络网上有很多办法,百度 ...

  6. Oracle RAC集群搭建(二)-基础环境配置

    01,创建用户,用户组 [root@rac1 ~]# groupadd -g 501 oinstall [root@rac1 ~]# groupadd -g 502 dba [root@rac1 ~] ...

  7. MyBatis操作指南-搭建项目基础环境(基于Java API)含log4j2配置

  8. MyBatis操作指南-搭建项目基础环境(基于XML)含log4j配置

  9. 搭建docker hadoop环境

    目录 搭建Docker-Hadoop基础环境 简介 步骤 搭建Docker image ..待续 注释 搭建Docker-Hadoop基础环境 简介 因为很难真正的有一个集群环境.在一般的条件下想要模 ...

随机推荐

  1. Intellij-IDEA-maven+springMVC+mybatis整合

    2019独角兽企业重金招聘Python工程师标准>>> GitHub地址 https://github.com/Ethel731/WebProjectDemo 前言 之前都是在已经建 ...

  2. 高性能服务器开发基础系列 (二)Reactor模式

    系列目录 第01篇 主线程与工作线程的分工 第02篇 Reactor模式 第03篇 一个服务器程序的架构介绍 第04篇 如何将socket设置为非阻塞模式 第05篇 如何编写高性能日志 第06篇 关于 ...

  3. 图论--最小环--Floyd模板

    #include <iostream> #include <algorithm> #include <cstdio> #include <cstring> ...

  4. codeforce 266c Below the Diagonal 矩阵变换 (思维题)

    C. Below the Diagonal You are given a square matrix consisting of n rows and n columns. We assume th ...

  5. Jenkins 构建 Jmeter 项目之源代码管理(SVN)

    1.查看项目创建中是否又 svn 插件,没有的话下载插件 subversion 2.配置 svn 源代码管理,如下图(testcases 目录下包含 build.xml 和脚本文件) 3.查看 Jen ...

  6. [E. Ehab's REAL Number Theory Problem](https://codeforces.com/contest/1325/problem/E) 数论+图论 求最小环

    E. Ehab's REAL Number Theory Problem 数论+图论 求最小环 题目大意: 给你一个n大小的数列,数列里的每一个元素满足以下要求: 数据范围是:\(1<=a_i& ...

  7. restful 架构风格的curd(增删改查)

    restful架构 概念:REST指的是一组架构约束条件和原则,如果一个架构符合REST的约束条件和原则,就称之为RESTful架构. restful不是一个专门的技术,他是一个规范.规范就是写写代码 ...

  8. SSM整合案例:图书管理系统

    目录 SSM整合案例:图书管理系统 1.搭建数据库环境 2.基本环境搭建 2.1.新建一个Maven项目,起名为:ssmbuild,添加web的支持 2.2.导入pom的相关依赖 2.3.Maven静 ...

  9. 不需要爬虫也能轻松获取 unsplash 上的图片

    我经常会使用 unsplash, 这里面的图片非常清爽,我的大多数文章的图片都是在这个网上找的,虽然也有同类型网站,但是用过一段时间以后基本都放弃了,图片质量参差不齐,筛选过程太费劲. 但是 unsp ...

  10. Python Serial 串口基本操作(收发数据)

    1.需要模块以及测试工具 模块名:pyserial 使用命令下载:python -m pip install pyserial 串口调试工具:sscom5.13.1.exe 2.导入模块 import ...