mac上搭建istio环境

一、docker、kubernetes 准备

下载安装Mac docker desktop, 下载地址: https://docs.docker.com/get-docker/
Docker Desktop 安装完成后,打开preferences界面,在kubernetes子界面中勾选上: Enable Kubernetes 和 Show system containers (advanced) ,点击Apply & Restart
在这里插入图片描述

重启之后kubernetes环境就搭建完成了。

二、istio 环境部署

本文档采用helm安装istio,如果使用istioctl安装可以参考官网的使用 Istioctl 安装

本文helm安装也是参考官网 使用 Helm 安装

下载istio安装文件

下载地址:https://github.com/istio/istio/releases
从上面的链接中选择一个版本下载到本地,将部署包解压缩后,将istio的bin目录添加到path中,在~/.zshrc 添加如下内容:

#istio
export ISTIO_HOME={
    
    parent_dir}/istio-1.12.9
export PATH=$PATH:$ISTIO_HOME/bin

保存退出。执行source 命令使修改生效:

source ~/.zshrc

安装helm

Mac 安装helm有两种方式,分别是使用brew或者下载helm编译文件

1、brew 安装helm

执行安装命令:

brew install helm

或者

brew install kubernetes-helm

2、helm编译文件

下载helm 编译版,地址:https://github.com/helm/helm/releases
下载后,将helm添加环境变量path中。

使用helm安装istio环境

进入istio解压后的目录,

  1. 为 Istio 组件,创建命名空间 istio-system :

    kubectl create namespace istio-system
    
  2. 安装 Istio base chart,它包含了 Istio 控制平面用到的集群范围的资源:

    helm install istio-base -n istio-system manifests/charts/base
    
  3. 安装 Istio discovery,它用于部署 istiod 服务:

     helm install -n istio-system istio-17 manifests/charts/istio-control/istio-discovery
    
  4. 安装istio-ingress

    helm install -n istio-system istio-ingress manifests/charts/gateways/istio-ingress
    
  5. 安装istio-egress

    helm install -n istio-system istio-egress manifests/charts/gateways/istio-egress
    
  6. 安装istio cni插件
    可以不安装此插件,此插件安装后可能会导致pod创建失败
    安装命令如下:

    helm install istio-cni -n kube-system manifests/charts/istio-cni
    

安装addons

  1. 安装prometheus

    kubectl apply -f samples/addons/prometheus.yaml -n istio-system
    
  2. 安装jaeger

    kubectl apply -f samples/addons/jaeger.yaml -n istio-system
    
  3. 安装grafana

    kubectl apply -f samples/addons/grafana.yaml -n istio-system
    
  4. 安装kiali

    kubectl apply -f samples/addons/kiali.yaml -n istio-system
    

访问kiali

先绑定kiali对外端口

kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=kiali -o jsonpath='{.items[0].metadata.name}') 20001:20001

然后通过浏览器访问kiali
在这里插入图片描述

卸载istio

执行如下命令:

kubectl delete -f samples/addons/prometheus.yaml -n istio-system
kubectl delete -f samples/addons/jaeger.yaml -n istio-system
kubectl delete -f samples/addons/grafana.yaml -n istio-system
kubectl delete -f samples/addons/kiali.yaml -n istio-system


helm uninstall -n istio-system istio-egress manifests/charts/gateways/istio-egress
helm uninstall -n istio-system istio-ingress manifests/charts/gateways/istio-ingress
helm uninstall -n istio-system istio-17 manifests/charts/istio-control/istio-discovery
helm uninstall istio-base -n istio-system manifests/charts/base

猜你喜欢

转载自blog.csdn.net/Mr_rain/article/details/125999281