小言_互联网的博客

istio-1.0安装

395人阅读  评论(0)

安装参考:

https://istio.io/zh/docs/setup/kubernetes/quick-start/

注意的地方:

1. 由于我们的k8s集群不支持外部LoadBalancer,所以需要把istio-ingressgateway 改为 NodePort方式:

编辑 istio-1.0.0/install/kubernetes/istio-demo.yaml

....

apiVersion: v1
kind: Service
metadata:
  name: istio-ingressgateway
  namespace: istio-system
  annotations:
  labels:
    chart: gateways-1.0.0
    release: RELEASE-NAME
    heritage: Tiller
    app: istio-ingressgateway
    istio: ingressgateway
spec:
  type: LoadBalancer  --> 改为 NodePort
  selector:
    app: istio-ingressgateway
    istio: ingressgateway
  ports:
    -
      name: http2
      nodePort: 31380
      port: 80
      targetPort: 80

......

安装完成后,服务如下:

$ kubectl get svc -n istio-system
NAME                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                                                                                                    AGE
grafana                    ClusterIP   10.254.27.204    <none>        3000/TCP                                                                                                   2d
istio-citadel              ClusterIP   10.254.90.240    <none>        8060/TCP,9093/TCP                                                                                          2d
istio-egressgateway        ClusterIP   10.254.53.36     <none>        80/TCP,443/TCP                                                                                             2d
istio-galley               ClusterIP   10.254.163.48    <none>        443/TCP,9093/TCP                                                                                           2d
istio-ingressgateway       NodePort    10.254.199.166   <none>        80:31380/TCP,443:31390/TCP,31400:31400/TCP,15011:22168/TCP,8060:42421/TCP,15030:7473/TCP,15031:26244/TCP   2d
istio-pilot                ClusterIP   10.254.155.110   <none>        15010/TCP,15011/TCP,8080/TCP,9093/TCP                                                                      2d
istio-policy               ClusterIP   10.254.210.53    <none>        9091/TCP,15004/TCP,9093/TCP                                                                                2d
istio-sidecar-injector     ClusterIP   10.254.46.149    <none>        443/TCP                                                                                                    2d
istio-statsd-prom-bridge   ClusterIP   10.254.76.221    <none>        9102/TCP,9125/UDP                                                                                          2d
istio-telemetry            ClusterIP   10.254.115.190   <none>        9091/TCP,15004/TCP,9093/TCP,42422/TCP                                                                      2d
jaeger-agent               ClusterIP   None             <none>        5775/UDP,6831/UDP,6832/UDP                                                                                 2d
jaeger-collector           ClusterIP   10.254.55.119    <none>        14267/TCP,14268/TCP                                                                                        2d
jaeger-query               ClusterIP   10.254.251.131   <none>        16686/TCP                                                                                                  2d
prometheus                 ClusterIP   10.254.110.80    <none>        9090/TCP                                                                                                   2d
servicegraph               ClusterIP   10.254.216.124   <none>        8088/TCP                                                                                                   2d
tracing                    ClusterIP   10.254.145.150   <none>        80/TCP                                                                                                     2d
zipkin                     ClusterIP   10.254.224.218   <none>        9411/TCP                                                                                                   2d

外部访问集群里面的服务,是通过 istio-ingressgateway 进入。如上,内部80端口映射外部访问端口为31380,443端口映射外部访问端口31390,所以当你创建了虚拟服务访问k8s集群内部服务时,需要附加上这个端口号,如访问istio booinfo的例子:

http://192.168.0.7:31380/productpage

当然,如果你想使用默认端口,可以修改安装文件:istio-1.0.0/install/kubernetes/istio-demo.yaml ,如下:

......
apiVersion: v1
kind: Service
metadata:
  name: istio-ingressgateway
  namespace: istio-system
  annotations:
  labels:
    chart: gateways-1.0.0
    release: RELEASE-NAME
    heritage: Tiller
    app: istio-ingressgateway
    istio: ingressgateway
spec:
  type: NodePort
  selector:
    app: istio-ingressgateway
    istio: ingressgateway
  ports:
    -
      name: http2
      nodePort: 31380 --> 改为 80
      port: 80
      targetPort: 80
    -
      name: https
      nodePort: 31390 --> 改为 443
      port: 443
......

2. 安装前需要先安装 metric server, 由于部分服务需要使用hpa来动态扩容。

$ kubectl get hpa -n istio-system
NAME                   REFERENCE                         TARGETS   MINPODS   MAXPODS   REPLICAS   AGE
istio-egressgateway    Deployment/istio-egressgateway    64%/60%   1         5         5          2d
istio-ingressgateway   Deployment/istio-ingressgateway   68%/60%   1         5         5          2d
istio-policy           Deployment/istio-policy           60%/80%   1         5         1          2d
istio-telemetry        Deployment/istio-telemetry        81%/80%   1         5         5          2d

metric server安装参考: https://blog.csdn.net/kozazyh/article/details/81369126

3. 使用sidecar自动注入,需要配置kubernetes:

参考: https://blog.csdn.net/kozazyh/article/details/81326363

 


转载:https://blog.csdn.net/kozazyh/article/details/81509183
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场