Service Mesh istio 部署在kubernetes v1.11.2 简单记录

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_21816375/article/details/83386306

系统

[root@master-47-35 istio-1.1.0.snapshot.1]# uname -a 
Linux master-47-35 3.10.0-327.4.5.el7.x86_64 #1 SMP Mon Jan 25 22:07:14 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

kubernetes版本

[root@master-47-35 istio-1.1.0.snapshot.1]# kubectl version 
Client Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0-168+f47446a730ca03", GitCommit:"f47446a730ca037473fb3bf0c5abeea648c1ac12", GitTreeState:"clean", BuildDate:"2018-08-25T21:05:52Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0-168+f47446a730ca03", GitCommit:"f47446a730ca037473fb3bf0c5abeea648c1ac12", GitTreeState:"clean", BuildDate:"2018-08-25T21:05:52Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}

开始部署istio

1.下载源码

wget https://github.com/istio/istio/releases/download/1.1.0.snapshot.1/istio-1.1.0.snapshot.1-linux.tar.gz

2.解压

tar -zxvf istio-1.1.0.snapshot.1-linux.tar.gz

修改yaml文件
把谷歌的镜像改为990570827镜像库,example 990570827/proxyv2:1.1.0.snapshot.1

3.部署

cd istio-1.1.0.snapshot.1
[root@master-47-35 istio-1.1.0.snapshot.1]# kubectl create -f install/kubernetes/istio-demo.yaml 

查看部署结果

[root@master-47-35 istio-1.1.0.snapshot.1]# kubectl get all -n istio-system 
NAME                                          READY     STATUS      RESTARTS   AGE
pod/grafana-6f5678c94b-v7mh6                  1/1       Running     0          3h
pod/istio-citadel-7f68b59fc9-fmg9d            1/1       Running     0          3h
pod/istio-cleanup-secrets-kxdmb               0/1       Completed   0          3h
pod/istio-egressgateway-669d8b6fdf-fqzt9      1/1       Running     0          3h
pod/istio-galley-866d669949-zqgnc             1/1       Running     0          3h
pod/istio-grafana-post-install-s8qsj          0/1       Completed   0          3h
pod/istio-ingressgateway-7c45d4d67d-r8mth     1/1       Running     0          3h
pod/istio-pilot-6ddb675d47-krjnt              2/2       Running     0          3h
pod/istio-policy-5f84b49499-2jfpn             2/2       Running     0          3h
pod/istio-security-post-install-4dq9v         0/1       Completed   0          3h
pod/istio-sidecar-injector-768488bbdc-6k2rq   1/1       Running     0          3h
pod/istio-telemetry-79b769f6f8-zntx6          2/2       Running     0          3h
pod/istio-tracing-7cd54799d8-9gm74            1/1       Running     0          3h
pod/prometheus-6574b56df9-mwqdg               1/1       Running     0          3h
pod/servicegraph-569554df7d-9v27h             1/1       Running     0          3h

NAME                             TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                                                                                                                   AGE
service/grafana                  ClusterIP      10.254.47.45    <none>        3000/TCP                                                                                                                  3h
service/istio-citadel            ClusterIP      10.254.42.229   <none>        8060/TCP,9093/TCP                                                                                                         3h
service/istio-egressgateway      ClusterIP      10.254.18.253   <none>        80/TCP,443/TCP                                                                                                            3h
service/istio-galley             ClusterIP      10.254.51.34    <none>        443/TCP,9093/TCP,9901/TCP                                                                                                 3h
service/istio-ingressgateway     LoadBalancer   10.254.25.173   <pending>     80:31380/TCP,443:31390/TCP,31400:31400/TCP,15011:30345/TCP,8060:30837/TCP,853:30173/TCP,15030:31850/TCP,15031:31125/TCP   3h
service/istio-pilot              ClusterIP      10.254.15.200   <none>        15010/TCP,15011/TCP,8080/TCP,9093/TCP                                                                                     3h
service/istio-policy             ClusterIP      10.254.58.242   <none>        9091/TCP,15004/TCP,9093/TCP                                                                                               3h
service/istio-sidecar-injector   ClusterIP      10.254.4.176    <none>        443/TCP                                                                                                                   3h
service/istio-telemetry          ClusterIP      10.254.56.53    <none>        9091/TCP,15004/TCP,9093/TCP,42422/TCP                                                                                     3h
service/jaeger-agent             ClusterIP      None            <none>        5775/UDP,6831/UDP,6832/UDP                                                                                                3h
service/jaeger-collector         ClusterIP      10.254.9.76     <none>        14267/TCP,14268/TCP                                                                                                       3h
service/jaeger-query             ClusterIP      10.254.15.22    <none>        16686/TCP                                                                                                                 3h
service/prometheus               ClusterIP      10.254.3.16     <none>        9090/TCP                                                                                                                  3h
service/servicegraph             ClusterIP      10.254.59.91    <none>        8088/TCP                                                                                                                  3h
service/tracing                  ClusterIP      10.254.46.220   <none>        80/TCP                                                                                                                    3h
service/zipkin                   ClusterIP      10.254.28.142   <none>        9411/TCP                                                                                                                  3h

NAME                                     DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/grafana                  1         1         1            1           3h
deployment.apps/istio-citadel            1         1         1            1           3h
deployment.apps/istio-egressgateway      1         1         1            1           3h
deployment.apps/istio-galley             1         1         1            1           3h
deployment.apps/istio-ingressgateway     1         1         1            1           3h
deployment.apps/istio-pilot              1         1         1            1           3h
deployment.apps/istio-policy             1         1         1            1           3h
deployment.apps/istio-sidecar-injector   1         1         1            1           3h
deployment.apps/istio-telemetry          1         1         1            1           3h
deployment.apps/istio-tracing            1         1         1            1           3h
deployment.apps/prometheus               1         1         1            1           3h
deployment.apps/servicegraph             1         1         1            1           3h

NAME                                                DESIRED   CURRENT   READY     AGE
replicaset.apps/grafana-6f5678c94b                  1         1         1         3h
replicaset.apps/istio-citadel-7f68b59fc9            1         1         1         3h
replicaset.apps/istio-egressgateway-669d8b6fdf      1         1         1         3h
replicaset.apps/istio-galley-866d669949             1         1         1         3h
replicaset.apps/istio-ingressgateway-7c45d4d67d     1         1         1         3h
replicaset.apps/istio-pilot-6ddb675d47              1         1         1         3h
replicaset.apps/istio-policy-5f84b49499             1         1         1         3h
replicaset.apps/istio-sidecar-injector-768488bbdc   1         1         1         3h
replicaset.apps/istio-telemetry-79b769f6f8          1         1         1         3h
replicaset.apps/istio-tracing-7cd54799d8            1         1         1         3h
replicaset.apps/prometheus-6574b56df9               1         1         1         3h
replicaset.apps/servicegraph-569554df7d             1         1         1         3h

NAME                                                       REFERENCE                         TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
horizontalpodautoscaler.autoscaling/istio-egressgateway    Deployment/istio-egressgateway    <unknown>/80%   1         5         1          3h
horizontalpodautoscaler.autoscaling/istio-ingressgateway   Deployment/istio-ingressgateway   <unknown>/80%   1         5         1          3h
horizontalpodautoscaler.autoscaling/istio-pilot            Deployment/istio-pilot            <unknown>/80%   1         5         1          3h
horizontalpodautoscaler.autoscaling/istio-policy           Deployment/istio-policy           <unknown>/80%   1         5         1          3h
horizontalpodautoscaler.autoscaling/istio-telemetry        Deployment/istio-telemetry        <unknown>/80%   1         5         1          3h

NAME                                    DESIRED   SUCCESSFUL   AGE
job.batch/istio-cleanup-secrets         1         1            3h
job.batch/istio-grafana-post-install    1         1            3h
job.batch/istio-security-post-install   1         1            3h

添加istioctl工具到PATH

[root@master-47-35 istio-1.1.0.snapshot.1]# cp bin/istioctl /usr/bin/

部署bookinfo例子

部署网关

kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml

部署bookinfo

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

查看部署结果

[root@master-47-35 istio-1.1.0.snapshot.1]# kubectl get svc 
NAME          TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
details       ClusterIP   10.254.39.12    <none>        9080/TCP         2h
kubernetes    ClusterIP   10.254.0.1      <none>        443/TCP          62d
productpage   NodePort    10.254.19.163   <none>        9080:30530/TCP   2h
ratings       ClusterIP   10.254.50.244   <none>        9080/TCP         2h
reviews       ClusterIP   10.254.23.91    <none>        9080/TCP         2h

[root@master-47-35 istio-1.1.0.snapshot.1]# kubectl get po
NAME                             READY     STATUS             RESTARTS   AGE
details-v1-6764bbc7f7-5kcps      1/1       Running            0          2h
productpage-v1-54b8b9f55-mdpjk   1/1       Running            0          2h
ratings-v1-7bc85949-ffhcd        1/1       Running            0          2h
reviews-v1-fdbf674bb-98vnm       1/1       Running            0          2h
reviews-v2-5bdc5877d6-9qws8      1/1       Running            0          2h
reviews-v3-dd846cc78-mx2v2       1/1       Running   0         2h

使用节点端口时确定入口IP和端口

export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')

export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n istio-system -o 'jsonpath={.items[0].status.hostIP}')
[root@master-47-35 istio-1.1.0.snapshot.1]# env | grep GATEWAY_URL
GATEWAY_URL=10.39.47.35:31380

##部署网关
kubectl apply -f samples/bookinfo/networking/destination-rule-all.yaml

验证

[root@master-47-35 istio-1.1.0.snapshot.1]# curl -o /dev/null -s -w "%{http_code}\n" http://${GATEWAY_URL}/productpage
200

访问
booinfo-01

boo
end
这边文章只是简单记录一下istio的部署过程
参考:
quick-start
Service Mesh实践之Istio初体验
bookinfo
determining-the-ingress-ip-and-ports

猜你喜欢

转载自blog.csdn.net/qq_21816375/article/details/83386306