安裝istio的Bookinfo,在kubeadm安裝的kubernetes單節點叢集上
阿新 • • 發佈:2018-11-11
安裝叢集看這個
使用kubeadm安裝單節點kubernetes叢集,在vmware虛擬機器centos7
下載istio
curl -L https://git.io/getLatestIstio | sh -
cd istio-1.0.2
把當前目錄下bin,加入path , centos .bashrc
export PATH="$PATH:/root/istio-1.0.2/bin"
安裝istio到kuberbetes叢集內
安裝istio定義的資源,就是kuberbetes可以定義一些資源,類似資料型別 kubectl apply -f install/kubernetes/helm/istio/templates/crds.yaml kubeadm安裝的kubernetes是有TLS authentication kubectl apply -f install/kubernetes/istio-demo-auth.yaml
檢視是否安裝正常
kubectl get svc -n istio-system 注意有istio-sidecar-injector,就是自動注入sidecar,在選擇安裝bookinfo時,with automatic sidecar injection
kubectl get pods -n istio-system 確保status是,running或者Completed,安裝kubernetes時,開啟docker proxy代理,這是要docker pull image
安裝bookinfo
kubectl label namespace default istio-injection=enabled kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
確認安裝好
kubectl get services
kubectl get pods 確保status是,running
安裝ingress gateway
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
kubectl get gateway
判斷設定訪問地址,我是電腦上vmware虛擬機器內安裝
does [not] have an external load balancer export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}') export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n istio-system -o 'jsonpath={.items[0].status.hostIP}') export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT
測試,訪問
curl -o /dev/null -s -w "%{http_code}\n" http://${GATEWAY_URL}/productpage
200
瀏覽器訪問
列印地址
echo ${GATEWAY_URL}
替換得到地址 http://${GATEWAY_URL}/productpage
只訪問http://${GATEWAY_URL},會提示404不存在,一定要試試全路徑