K8S 生产实践-17-2-部署 stio
一、安装istioctl
1. 下载istioctl
istioctl需要下载到部署了kubectl的节点上
1.1 github官方下载
# 下载安装脚本(有时候会出现下载不下来的问题,可以直接使用文档中的脚本文件)
$ curl -sL https://istio.io/downloadIstioctl > download-istioctl.sh
# 执行脚本下载
## 下载指定版本
$ ISTIO_VERSION=1.9.5 sh download-istioctl.sh
## 下载最新版本
$ sh download-istioctl.sh
1.2 网盘下载
由于github的网络不稳定,时常无法访问,课程在准备了现成的二进制文件放在网盘供大家下载
链接: https://pan.baidu.com/s/1akMTf606lVzOWFdhnXOmsQ 提取码: nnw4
2. 解压缩,并设置好环境
把istioctl加入到PATH里面,并测试可用性
[root@hombd04 softwares]# tar -xvf istio-1.9.5-linux-amd64.tar.gz -C /opt/modules/
[root@hombd04 ]# cd /opt/modules/istio-1.9.5
# 解压缩下载的文件后,进入到istio的bin目录中
$ cd istio-1.9.5/bin
# 把当前目录添加到PATH
$ export PATH=$PATH:`pwd`
# 测试
$ istioctl version
client version: 1.9.5
control plane version: 1.9.5
data plane version: 1.9.5 (8 proxies)
[root@hombd04 bin]# istioctl version
no running Istio pods in "istio-system"
1.9.5
[root@homaybd04 bin]#
二、使用IstioOperator部署istio
1. 初始化
$ istioctl operator init
[root@hombd04 bin]# istioctl operator init
Installing operator controller in namespace: istio-operator using image: docker.io/istio/operator:1.9.5
Operator controller will watch namespaces: istio-system
✔ Istio operator installed
✔ Installation complete
此命令运行 operator 在 istio-operator 命名空间中创建以下资源:
- operator 自定义资源定义(CRD)
- operator 控制器的 deployment 对象
- 一个用来访问 operator 指标的服务
- Istio operator 运行必须的 RBAC 规则
2. 安装
# 使用 operator 安装 Istio(demo的profile,该有的不该有的都有了)
$ kubectl create ns istio-system
$ kubectl apply -f - <<EOF
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: example-istiocontrolplane
spec:
profile: demo
EOF
3. 检查安装结果
# 查看service
$ kubectl get svc -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
istio-egressgateway ClusterIP 10.103.243.113 <none> 80/TCP,443/TCP,15443/TCP 17s
istio-ingressgateway LoadBalancer 10.101.204.227 <pending> 15020:31077/TCP,80:30689/TCP,443:32419/TCP,31400:31411/TCP,15443:30176/TCP 17s
istiod ClusterIP 10.96.237.249 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP,53/UDP,853/TCP 30s
# 查看pod
$ kubectl get pods -n istio-system
NAME READY STATUS RESTARTS AGE
istio-egressgateway-5444c68db8-9h6dz 1/1 Running 0 87s
istio-ingressgateway-5c68cb968-x7qv9 1/1 Running 0 87s
istiod-598984548d-wjq9j 1/1 Running 0 99s
相关文章:
K8S 生产实践-17-1-ServiceMesh 代表作-Istio
为者常成,行者常至
自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)