深入浅出Istio:Service Mesh快速入门与实践
上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人

4.2 快速部署Istio

Istio的发布页面位于https://github.com/istio/istio/releases/,其中包含各个客户端平台下Istio的各个版本,例如OS X下Istio 1.0.4版本的安装包名称为istio-1.0.4-osx.tar.gz。在下载安装包后进行解压。

接下来,进入解压后的安装目录;将bin目录中的istioctl复制到一个PATH包含的路径中,例如cp bin/istioctl /usr/local/bin;之后开始部署Istio:

$ kubectl apply -f install/kubernetes/istio-demo.yaml

在部署开始后,可以看到类似下面的输出内容:

……
configmap/istio created
configmap/istio-sidecar-injector created
serviceaccount/istio-galley-service-account created
serviceaccount/istio-egressgateway-service-account created
……
clusterrole.rbac.authorization.k8s.io/istio-grafana-post-install-istio-system created
clusterrolebinding.rbac.authorization.k8s.io/istio-grafana-post-instal l-role-binding-istio-system created
job.batch/istio-grafana-post-install created
……
serviceaccount/prometheus created
serviceaccount/istio-cleanup-secrets-service-account created
clusterrole.rbac.authorization.k8s.io/istio-cleanup-secrets-istio-syst em created
……
customresourcedefinition.apiextensions.k8s.io/instances.config.istio.i o created
customresourcedefinition.apiextensions.k8s.io/templates.config.istio.io created
……
kubernetes.config.istio.io/attributes created
destinationrule.networking.istio.io/istio-policy created
destinationrule.networking.istio.io/istio-telemetry created

不难看出,除了常见的Deployment、Service、Configmap、ServiceAccount等Kubernetes对象,这里还创建了大量的CRD及各种CRD的下属资源。

运行如下命令,查看istio-system命名空间中的Pod启动状况,其中的-w参数用于持续查询Pod状态的变化:

$ kubectl get pods -n istio-system -w
NAME                                     READY   STATUS   RESTARTS  AGE
grafana-59b787b9b-ncw59                   1/1   Running      0      15m
istio-citadel-5d8956cc6-b4m7w             1/1   Running      0      15m
istio-cleanup-secrets-m9xlk               0/1   Completed    0      17m
istio-egressgateway-7cf89fb4f7-b4wk5     1/1   Running      0      15m
istio-galley-6975b6bd45-qm79m             1/1   Running      0      15m
istio-ingressgateway-6996d566d4-vm2ws    1/1   Running      0      15m
istio-pilot-ccdc987c7-bjfbc               2/2   Running      0      15m
istio-policy-5b99bdc4f-dpcb8              2/2   Running      0      15m
istio-sidecar-injector-575597f5cf-5fp4w  1/1   Running      0      15m
istio-telemetry-6bf849d48d-zgcdq         2/2   Running      0      15m
istio-tracing-7596597bd7-fmngj            1/1   Running      0      15m
prometheus-76db5fddd5-z4tc9               1/1   Running      0      15m
servicegraph-758f96bf5b-4gscm             1/1   Running      1      15m

在列表中会看到有的Pod状态为Completed,不用担心,这是在安装过程中运行的一些Job留下的Pod, Completed状态说明Job执行成功。