近幾天Istio1.1的發佈引起了技術界巨大的反響,爲了讓更多技術愛好者能夠親自體驗Istio1.1,公司的技術大佬趕出了這篇嚐鮮教程,其中包括環境、安裝、可能遇到的問題及解決方式等,希望對大家有所幫助。
環境
已經安裝了 Kubernetes 集羣,有1個 master 和4個 node。操作系統都是 CentOS Linux 7。
下載 Istio 安裝文件
curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.1.0 sh -
export PATH="$PATH:/root/istio-1.1.0/bin"
安裝 Tiller
這裏選擇在 Helm 和 Tiller 的環境中使用 helm install
命令進行安裝的方式。
kubectl apply -f install/kubernetes/helm/helm-service-account.yaml
假如已經安裝過,結果如下:
helm init --service-account tiller
安裝 istio-init chart
更新 Helm 的本地包緩存:
helm repo add istio.io "https://gcsweb.istio.io/gcs/istio-prerelease/daily-build/release-1.1-latest-daily/charts/"
安裝 istio-init chart,來啓動 Istio CRD 的安裝過程:
helm install istio.io/istio-init --name istio-init --namespace istio-system
確認 Istio 的 CRD 都已經成功的提交給 Kubernetes API Server:
kubectl get crds | grep 'istio.io\|certmanager.k8s.io' | wc -l
55
安裝 istio
helm install install/kubernetes/helm/istio --name istio --namespace istio-system \
--set tracing.enabled=true \
--set jaeger.enabled=true \
--set grafana.enabled=true \
--set kiali.enabled=true \
--set "kiali.dashboard.jaegerURL=http://tracing-istio-system.apps.cloud2go.cn" \
--set "kiali.dashboard.grafanaURL=http://grafana-istio-system.apps.cloud2go.cn”
輸出結果如下:
NAME: istio
LAST DEPLOYED: Wed Mar 20 02:19:04 2019
NAMESPACE: istio-system
STATUS: DEPLOYED
RESOURCES:
==> v1/ClusterRole
NAME AGE
istio-citadel-istio-system 2m17s
istio-galley-istio-system 2m17s
istio-grafana-post-install-istio-system 2m17s
istio-ingressgateway-istio-system 2m17s
istio-mixer-istio-system 2m17s
istio-pilot-istio-system 2m17s
istio-reader 2m17s
istio-sidecar-injector-istio-system 2m17s
kiali 2m17s
prometheus-istio-system 2m17s
...這裏省略一部分輸出...
NOTES:
Thank you for installing istio.
Your release is named istio.
To get started running application with Istio,`` execute the following steps:
1. Label namespace that application object will be deployed to by the following command (take default namespace as an example)
$ kubectl label namespace default istio-injection=enabled
$ kubectl get namespace -L istio-injection
2. Deploy your applications
$ kubectl apply -f <your-application>.yaml
For more information on running Istio, visit:
https://istio.io/
查看 istio 的 pod:
遇到的問題及解決
- istio-init 需要的鏡像拉不下來
kubectl describe po istio-init-crd-10-vmq9p -n istio-system
解決:到可以拉到的機器拉取到所有需要的鏡像,再導入到集羣
- 安裝完成後,給 kiali 創建 ingress 成功但是瀏覽器訪問結果是404
解決:直接訪問域名不會自動跳轉,需要加 /kiali/console
才能進入登陸界面