为什么80%的码农都做不了架构师?>>>
安装istio
下载istio
curl -L https://git.io/getLatestIstio | sh -
cd istio-1.0.5/
使用helm安装istio 配置改成NodePort
helm template install/kubernetes/helm/istio \
--name istio \
--namespace istio-system \
--set sidecarInjectorWebhook.enabled=true \
--set ingress.service.type=NodePort \
--set gateways.istio-ingressgateway.type=NodePort \
--set gateways.istio-egressgateway.type=NodePort \
--set tracing.enabled=true \
--set servicegraph.enabled=true \
--set prometheus.enabled=true \
--set tracing.jaeger.enabled=true \
--set grafana.enabled=true \
> istio.yaml
kubectl create namespace istio-system
kubectl create -f istio.yaml
监控istio部署情况
kubectl get pods -n istio-system
测试istio路由
安装httpbin
kubectl apply -f samples/httpbin/httpbin.yaml
查看istio ingressgateway端口
kubectl get svc istio-ingressgateway -n istio-system
// 80:31380/TCP,443:31390/TCP
查看istio ingressgateway部署机器ip
export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n istio-system -o 'jsonpath={.items[0].status.hostIP}')
echo $INGRESS_HOST
配置外部nginx反向代理到ip和端口(省略)
配置istio路由
cat <
访问 http://xxxxx/headers 打印出请求header结果
清理测试数据
kubectl delete gateway httpbin-gateway
kubectl delete virtualservice httpbin
kubectl delete --ignore-not-found=true -f samples/httpbin/httpbin.yaml
参考资料
https://istio.io/docs/setup/kubernetes/helm-install/
http://ju.outofmemory.cn/entry/364880