当前位置: 代码迷 >> 综合 >> Istio 安装部署
  详细解决方案

Istio 安装部署

热度:81   发布时间:2024-02-20 10:04:20.0

Istio 下载

可以按照自己的需要下载指定的版本,或者下载最新的版本

下载指定版本的 Istio

指定版本为1.4.6去下载
curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.4.6 sh -

进入 Istio 目录
cd istio-1.4.6

配置 Istio 环境变量
export PATH=$PWD/bin:$PATH
在这里插入图片描述

下载最新版本的 Istio

获取 Istio 最新的版本号
VERSION=$(curl --silent "https://api.github.com/repos/istio/istio/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')

下载最新版本的 Istio
curl -L https://git.io/getLatestIstio | ISTIO_VERSION=$VERSION sh -

进入 Istio 目录
cd istio-$VERSION

配置 Istio 环境变量
export PATH=$PWD/bin:$PATH
在这里插入图片描述

Istio 部署

指定profile为demo
istioctl manifest apply --set profile=demo
在这里插入图片描述

将IngressGateway ServiceType修改成NodePort,已便于在裸机上测试
kubectl patch svc -n istio-system istio-ingressgateway -p '{"spec": {"type": "NodePort"}}'
在这里插入图片描述

Profile 分类

default:根据IstioOperatorAPI的默认设置启用组件 (建议用于生产部署)。

demo:旨在展示Istio功能且资源需求适中的配置。适合运行Bookinfo应用程序和相关任务。

minimal:使用Istio的流量管理功能所需的最少组件集。

sds: 在default的基础上再启用了SDS (secret discovery service) 功能和认证功能 (Strict Mutual TLS)。

remote:用于配置的远程簇的多组网格与共享控制平面配置。

empty:不部署任何内容,这可作为自定义配置的基本配置文件。

preview:预览配置文件包含实验性功能,不能保证稳定性,安全性和性能,请谨慎的选择此选项。

Istio 1.4 及之前
https://archive.istio.io/v1.5/pt-br/docs/setup/additional-setup/config-profiles/
在这里插入图片描述

Istio 1.5 & 1.6
https://istio.io/latest/docs/setup/additional-setup/config-profiles/
在这里插入图片描述

BookInfo

命名空间自动注入sidecar
kubectl label namespace default istio-injection=enabled

微服务部署
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml

服务入口配置
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml

检查到Pods中的Container数量为2,包括应用本身的Container,以及Istio的Sidecar。
kubectl get pod
在这里插入图片描述
通过NodeIP:IngressGatewayNodePort 即可访问到 Book Info 这个 Demo
在这里插入图片描述