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
安裝目錄中包含:
在 install/ 目錄中包含了 Kubernetes 安裝所需的 .yaml 檔案
samples/ 目錄中是示例應用
istioctl 用戶端檔案儲存在 bin/ 目錄之中。istioctl 的功能是手工進行 Envoy Sidecar 的注入,以及對路由規則、政策的管理
istio.VERSION 配置檔案
将 istioctl 用戶端二進制檔案加到 PATH 中。 例如,在 macOS 或 Linux 系統上執行下面的指令:
$ export PATH=$PWD/bin:$PATH
istio 安裝
選項1:通過 Helm 的 helm template 安裝 Istio
将 Istio 的核心元件呈現為名為 istio.yaml 的 Kubernetes 清單檔案:
$ helm template install/kubernetes/helm/istio --name istio --namespace istio-system > ./istio.yaml
通過清單檔案安裝元件
$ kubectl create namespace istio-system
$ kubectl create -f ./istio.yaml
2
由于istio元件中自定義了資源類型,而形成 istio.yaml檔案的時候,并不是先定義再使用資源類型的順序,是以你可以執行兩遍kubectl create -f ./istio.yaml 來實作正确安裝
解除安裝
$ kubectl delete -f ./istio.yaml
選項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
使用 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
安裝 Istio:
$ helm install install/kubernetes/helm/istio --name istio --namespace istio-system
$ helm delete --purge istio
如果您的 Helm 版本低于 2.9.0,那麼在重新部署新版 Istio chart 之前,您需要手動清理額外的 job 資源:
$ kubectl -n istio-system delete job --all
這裡寫了個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
---------------------
作者:資料架構師
來源:CSDN
原文:
https://blog.csdn.net/luanpeng825485697/article/details/84500612版權聲明:本文為部落客原創文章,轉載請附上博文連結!