您现在的位置是:首页 > 文章详情

k8s安装部署Istio

日期:2018-12-02点击:545

k8s安装部署Istio

Istio简介
Istio 官方推荐使用 Helm 来安装,Istio 中的很多组件都可以选择安装或开启,因此 Helm chart 也是组合式的,下载 Istio 安装包后解压可以看到 install/kubernetes/helm/istio 目录下的 Helm chart 配置文件,参考 使用 Helm 进行安装。

Istio 的安装文件中包括如下几个子 chart。

ingress
ingressgateway
egressgateway
sidecarInjectorWebhook
galley
mixer
pilot
security(citadel)
grafana
prometheus
servicegraph
tracing(jaeger)
kiali
所有的这些子 Chart 都可以通过 YAML 配置中的 enabled 标志选择性的开启,具体配置方法请参考安装包解压后的 install/kubernetes/helm/istio/README.md 文件。

istio 下载
Istio 会被安装到自己的 istio-system 命名空间,并且能够对所有其他命名空间的服务进行管理。

进入 Istio release 页面,下载对应目标操作系统的安装文件。在 macOS 或者 Linux 系统中,还可以运行下面的命令,进行下载和自动解压缩:

$ curl -L https://git.io/getLatestIstio | sh -
1
进入 Istio 包目录。假设这个包是 istio-1.0.4:

$ cd istio-1.0.4
1
安装目录中包含:

在 install/ 目录中包含了 Kubernetes 安装所需的 .yaml 文件
samples/ 目录中是示例应用
istioctl 客户端文件保存在 bin/ 目录之中。istioctl 的功能是手工进行 Envoy Sidecar 的注入,以及对路由规则、策略的管理
istio.VERSION 配置文件
将 istioctl 客户端二进制文件加到 PATH 中。 例如,在 macOS 或 Linux 系统上执行下面的命令:

$ export PATH=$PWD/bin:$PATH
1
istio 安装
选项1:通过 Helm 的 helm template 安装 Istio
将 Istio 的核心组件呈现为名为 istio.yaml 的 Kubernetes 清单文件:

$ helm template install/kubernetes/helm/istio --name istio --namespace istio-system > ./istio.yaml
1
通过清单文件安装组件

$ kubectl create namespace istio-system
$ kubectl create -f ./istio.yaml
1
2
由于istio组件中自定义了资源类型,而形成 istio.yaml文件的时候,并不是先定义再使用资源类型的顺序,所以你可以执行两遍kubectl create -f ./istio.yaml 来实现正确安装

卸载

$ kubectl delete -f ./istio.yaml
1
选项2:通过 Helm 和 Tiller 的 helm install 安装 Istio
此选项允许 Helm 和 Tiller 管理 Istio 的生命周期。

Warning 使用 Helm 升级 Istio 还没有进行全面的测试。

如果还没有为 Tiller 配置 service account,请配置一个:

$ kubectl create -f install/kubernetes/helm/helm-service-account.yaml
1
使用 service account 在您的集群中安装 Tiller:

$ helm init --service-account tiller --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.9.1 --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
1
安装 Istio:

$ helm install install/kubernetes/helm/istio --name istio --namespace istio-system
1
卸载

$ helm delete --purge istio
1
如果您的 Helm 版本低于 2.9.0,那么在重新部署新版 Istio chart 之前,您需要手动清理额外的 job 资源:

$ kubectl -n istio-system delete job --all
1
这里写了个sh脚本

install_type="templates"
#helm tiller安装
if [ install_type -eq "tiller" ]; then
kubectl create -f install/kubernetes/helm/helm-service-account.yaml
helm init --service-account tiller --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.9.1 --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
helm version
helm install install/kubernetes/helm/istio --name istio --namespace istio-system
fi
#helm  templates安装  
if [ install_type -eq "templates" ]; then
docker pull docker.io/istio/proxy_init:1.0.4
docker pull docker.io/istio/proxyv2:1.0.4
docker pull quay.io/coreos/hyperkube:v1.7.6_coreos.0
docker pull docker.io/istio/galley:1.0.4
docker pull docker.io/istio/mixer:1.0.4
docker pull docker.io/istio/pilot:1.0.4
docker pull docker.io/prom/prometheus:v2.3.1
docker pull docker.io/istio/citadel:1.0.4
docker pull docker.io/istio/sidecar_injector:1.0.4
helm template install/kubernetes/helm/istio --name istio --namespace istio-system > ./istio.yaml
kubectl create namespace istio-system
kubectl create -f ./istio.yaml    # 运行两次,因为自定义资源  并且使用顺序错了
kubectl create -f ./istio.yaml
fi
--------------------- 
作者:数据架构师 
来源:CSDN 
版权声明:本文为博主原创文章,转载请附上博文链接!
原文链接:https://yq.aliyun.com/articles/674737
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章