版本

Istio版本地址

Istio版本支持Kubernetess说明

名称版本
Kind0.12
kubectl1.23
Istio1.17

安装

安装Istioctl

# 下载
$ curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.17.4 sh -

# 加入到系统变量
$ cd istio-1.17.4 && export PATH=$PWD/bin:$PATH

安装示例应用

$ istioctl install --set profile=demo -y

✔ Istio core installed
✔ Istiod installed
✔ Egress gateways installed
✔ Ingress gateways installed
✔ Installation complete                                                                       

Making this installation the default for injection and validation.

Thank you for installing Istio 1.17.  Please take a few minutes to tell us about your install/upgrade experience!  https://forms.gle/hMHGiwZHPU7UQRWe9

安装自带插件

# 进入 istrio 安装目录
$ cd ~/Plugin/istio-1.17.4
$ 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

注入配置

自动注入

default 命名空间添加标签,指示 Istio 在部署应用的时候,自动注入配置
$ kubectl label namespace default istio-injection=enabled
namespace/default labeled

手动注入

将注册服务追加Istio配置通过管道传入到 kubectl 进行资源申请
$ istioctl kube-inject -f demo-http-server.yaml | kubectl apply -f

部署示例

deplayment兼容Istio需要元素: 应用标签metadata.labels, 版本标签 template.metadata.labels.version,容器端口: containers.ports.containerPort

server 兼容 Istio 需要元素: 服务端口名称ports.name, 命名规范需要参照文档

传送门: 服务协议名称命名规范

传送门: demo-http:v1.2

申请服务

$ kubectl apply -f demo.secret.yaml
$ kubectl apply -f demo.config.yaml
$ kubectl apply -f demo-http-server.yaml
$ kubectl apply -f demo.server.yaml

# 启动服务
$ kubectl port-forward service/demo-http 9011:9001 -n default

查看Istio监控

$ istioctl dashboard kiali

image-20240714154223134

删除

# 绝对路径为安装istios的根目录/samples/addons
$ kubectl delete -f samples/addons
$ kubectl delete svc demo-http
$ kubectl delete deployment --all
$ istioctl uninstall -y --purge

# 命名空间 istio-system 默认情况不会移除
$ kubectl delete namespace istio-system

# 自动注入 Envoy 代理默认不移除
$ kubectl label namespace default istio-injection-
Last modification:August 9th, 2024 at 01:04 pm