日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

service mesh istio-0.8安装测试

發布時間:2024/4/17 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 service mesh istio-0.8安装测试 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

簡介

istio是一個service mesh開源實現,由Google/IBM/Lyft共同開發。與之類似的還有conduit,但是功能不如istio豐富穩定。架構圖如下:

istio-0.8版本是第一個長期支持版本,相對于之前的版本配置改動較大。

安裝

# 去下面的地址下載壓縮包 # https://github.com/istio/istio/releases wget https://github.com/istio/istio/releases/download/0.8.0/istio-0.8.0-linux.tar.gz tar xf istio-0.8.0-linux.tar.gz# 使用官方的安裝腳本安裝 curl -L https://git.io/getLatestIstio | sh -# 安裝配置環境變量 mv istio-0.8.0 /usr/local/ ln -sv /usr/local/istio-0.8.0 /usr/local/istio echo 'export PATH=/usr/local/istio/bin:$PATH' > /etc/profile.d/istio.sh source /etc/profile.d/istio.sh istioctl version# 如果環境不是云環境,不支持LoadBalancer # 作如下修改,使得 ingressgateway 監聽在80和443端口 # 修改使用主機端口映射 # 使用此修改版本之后,每臺機器只能運行單個實例 # 大概在2661行左右 cd /usr/local/istio cp install/kubernetes/istio-demo.yaml install/kubernetes/istio-demo.yaml.ori vim install/kubernetes/istio-demo.yaml ... # Source: istio/charts/ingressgateway/templates/deployment.yaml apiVersion: extensions/v1beta1 # kind: Deployment # 使用DaemonSet部署方式 kind: DaemonSet metadata:name: istio-ingressgatewaynamespace: istio-systemlabels:app: ingressgatewaychart: ingressgateway-0.8.0release: RELEASE-NAMEheritage: Tilleristio: ingressgateway spec:# DaemonSet不支持replicas# replicas: template:metadata:labels:istio: ingressgatewayannotations:sidecar.istio.io/inject: "false"spec:serviceAccountName: istio-ingressgateway-service-accountcontainers:- name: ingressgatewayimage: "docker.io/istio/proxyv2:0.8.0"imagePullPolicy: IfNotPresentports:- containerPort: 80#主機80端口映射hostPort: 80- containerPort: 443#主機443端口映射hostPort: 443- containerPort: 31400#主機443端口映射hostPort: 31400 ...# 由于鏡像問題,提前拉取鏡像 # 在所有節點上執行如下命令輸出的命令 # 可能會失敗,需要多次執行 image=$(grep 'quay.io/coreos/hyperkube' install/kubernetes/istio-demo.yaml | head -1 | awk '{print $2}' | tr -d '"') echo "docker pull $image"# 以下兩種選擇一種安裝方式 # 安裝不使用認證(不使用tls) kubectl apply -f install/kubernetes/istio-demo.yaml# 安裝使用認證(使用tls) kubectl apply -f install/kubernetes/istio-demo-auth.yaml# 查看狀態 kubectl get svc -n istio-system kubectl get pods -n istio-system# 訪問測試 nodeName=$(kubectl get no | grep '<none>' | head -1 | awk '{print $1}') nodeIP=$(ping -c 1 $nodeName | grep PING | awk '{print $3}' | tr -d '()') echo "curl -I http://$nodeIP" 復制代碼

注意

istio-0.8.0 默認已經開啟了自動注入功能以及其他日志監控和追蹤的相關組件如

  • istio-tracing
  • istio-telemetry
  • grafana
  • prometheus
  • servicegraph

啟用自動注入 sidecar

  • 不開啟自動注入部署應用需要使用如下方式的命令

    kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/kube/bookinfo.yaml)

  • 開啟自動注入后,使用正常命令即可部署應用

    kubectl apply -f samples/bookinfo/kube/bookinfo.yaml

# istio-0.8.0默認已經開啟了自動注入功能# k8s 1.9 及之后的版本才能使用自動注入功能 # 查看是否支持 kubectl api-versions | grep admissionregistration# 除了要滿足以上條件外還需要檢查kube-apiserver啟動的參數 # k8s 1.9 版本要確保 --admission-control 里有 MutatingAdmissionWebhook,ValidatingAdmissionWebhook # k8s 1.9 之后的版本要確保 --enable-admission-plugins 里有MutatingAdmissionWebhook,ValidatingAdmissionWebhook# 測試自動注入 # 創建 kubectl apply -f samples/sleep/sleep.yaml kubectl get deployment -o wide kubectl get pod# 設置 default namespace 開啟自動注入 kubectl label namespace default istio-injection=enabled kubectl get namespace -L istio-injection# 刪除創建的pod,等待重建 kubectl delete pod $(kubectl get pod | grep sleep | cut -d ' ' -f 1)# 查看重建后的pod # 查看是否有istio-proxy容器 kubectl get pod kubectl describe pod $(kubectl get pod | grep sleep | cut -d ' ' -f 1)# 清理 kubectl delete -f samples/sleep/sleep.yaml # 關閉自動注入 kubectl label namespace default istio-injection-# 關閉部分pod的自動注入功能 ...template:metadata:annotations:sidecar.istio.io/inject: "false" ... 復制代碼

部署官方測試用例

# 啟動(未開啟自動注入) kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/kube/bookinfo.yaml)# 啟動(已開啟自動注入) kubectl apply -f samples/bookinfo/kube/bookinfo.yaml# 創建gateway istioctl create -f samples/bookinfo/routing/bookinfo-gateway.yaml# 查看狀態 kubectl get services kubectl get pods istioctl get gateway 復制代碼

訪問測試

# 命令行訪問測試 export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http")].nodePort}') NODE_NAME=$(kubectl get no | grep '<none>' | head -1 | awk '{print $1}') NODE_IP=$(ping -c 1 $NODE_NAME | grep PING | awk '{print $3}' | tr -d '()') export GATEWAY_URL=$NODE_IP:$INGRESS_PORT echo $GATEWAY_URLcurl -o /dev/null -s -w "%{http_code}\n" http://${GATEWAY_URL}/productpage# 瀏覽器訪問測試 echo "http://${GATEWAY_URL}/productpage"# 使用daemonset方式部署可以使用如下方式訪問 # 11.11.11.112為其中一個node節點的ip curl http://11.11.11.112/productpage 復制代碼

清理

# 清理官方用例 samples/bookinfo/kube/cleanup.sh# 清理istio kubectl delete -f install/kubernetes/istio-demo.yaml # kubectl delete -f install/kubernetes/istio-demo-auth.yaml 復制代碼

參考文檔

  • https://istio.io/docs/setup/kubernetes/quick-start.html
  • https://istio.io/docs/guides/bookinfo.html
  • https://istio.io/docs/setup/kubernetes/sidecar-injection.html#automatic-sidecar-injection

總結

以上是生活随笔為你收集整理的service mesh istio-0.8安装测试的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。