TungstenFabric環境でのIstioインストール
以下の動画の構成で、TungstenFabric環境でのIstioインストールを試してみている。
https://www.youtube.com/watch?v=VSNc9qd2poA
環境としては、AWS 上の CentOS7 (ami-3185744e) を使用し、
controller x 1: mem 8GB, disk 8GB, vRouter x 1: mem 4GB, disk 8GB
※ tungstenfabric, r5.0.1, istio-1.0.5 のモジュールで確認
で構築している。
instance.yaml 、インストール手順はこちらと同様となる。
http://aaabbb-200904.hatenablog.jp/entry/2019/02/03/195348
k8s, tungsten-fabric のインストールが完了した後、以下の参考リンクに従い、istio, および、 bookinfo のインストールを行っていく。
https://istio.io/docs/setup/kubernetes/download-release/
https://istio.io/docs/setup/kubernetes/quick-start/
https://istio.io/docs/examples/bookinfo/
まず最初に、istio 本体のインストールを行う。
$ curl -L https://git.io/getLatestIstio | sh - $ cd istio* $ export PATH=$PWD/bin:$PATH $ kubectl apply -f install/kubernetes/helm/istio/templates/crds.yaml $ kubectl apply -f install/kubernetes/istio-demo.yaml $ kubectl get pods -n istio-system -o wide ※ 5分程度で全 pod が起動 [root@ip-172-31-10-93 istio-1.0.5]# kubectl get pods -n istio-system -o wide NAME READY STATUS RESTARTS AGE IP NODE grafana-647f464b47-z5kqf 1/1 Running 0 2m 10.47.255.245 ip-172-31-4-44.ap-northeast-1.compute.internal istio-citadel-55f4559bf4-lpfll 1/1 Running 0 2m 10.47.255.241 ip-172-31-4-44.ap-northeast-1.compute.internal istio-egressgateway-5f6cc9565f-zz6x9 1/1 Running 0 2m 10.47.255.247 ip-172-31-4-44.ap-northeast-1.compute.internal istio-galley-6555f7b787-6zrxl 1/1 Running 0 2m 10.47.255.248 ip-172-31-4-44.ap-northeast-1.compute.internal istio-ingressgateway-7477597868-c9p66 1/1 Running 0 2m 10.47.255.246 ip-172-31-4-44.ap-northeast-1.compute.internal istio-pilot-5758759cf6-6vkn6 2/2 Running 0 2m 10.47.255.242 ip-172-31-4-44.ap-northeast-1.compute.internal istio-policy-6866bb777-h6shx 2/2 Running 0 2m 10.47.255.244 ip-172-31-4-44.ap-northeast-1.compute.internal istio-sidecar-injector-785d946b9f-8nl6p 1/1 Running 0 2m 10.47.255.238 ip-172-31-4-44.ap-northeast-1.compute.internal istio-telemetry-659c98f9d7-72j8r 2/2 Running 0 2m 10.47.255.243 ip-172-31-4-44.ap-northeast-1.compute.internal istio-tracing-77f9f94b98-zrxgg 1/1 Running 0 2m 10.47.255.237 ip-172-31-4-44.ap-northeast-1.compute.internal prometheus-67d4988588-zt6vb 1/1 Running 0 2m 10.47.255.240 ip-172-31-4-44.ap-northeast-1.compute.internal servicegraph-6948967d88-zvh9p 1/1 Running 0 2m 10.47.255.239 ip-172-31-4-44.ap-northeast-1.compute.internal [root@ip-172-31-10-93 istio-1.0.5]#
istio の pod が起動した後、以下のコマンドで、サンプルアプリである、 bookinfo のインストールを実施する。
$ kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/platform/kube/bookinfo.yaml) $ kubectl get svc -o wide [root@ip-172-31-10-93 istio-1.0.5]# kubectl get svc -o wide NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR details ClusterIP 10.108.145.18 <none> 9080/TCP 11s app=details kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 11m <none> productpage ClusterIP 10.106.227.189 <none> 9080/TCP 9s app=productpage ratings ClusterIP 10.107.149.71 <none> 9080/TCP 10s app=ratings reviews ClusterIP 10.109.60.194 <none> 9080/TCP 9s app=reviews [root@ip-172-31-10-93 istio-1.0.5]# [root@ip-172-31-10-93 istio-1.0.5]# kubectl get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE details-v1-845fc857bd-rfp2l 2/2 Running 0 1m 10.47.255.236 ip-172-31-4-44.ap-northeast-1.compute.internal productpage-v1-c8dbcd7f8-jblpx 2/2 Running 0 1m 10.47.255.231 ip-172-31-4-44.ap-northeast-1.compute.internal ratings-v1-6c788fb884-g5kb4 2/2 Running 0 1m 10.47.255.235 ip-172-31-4-44.ap-northeast-1.compute.internal reviews-v1-84476bcf59-55shq 2/2 Running 0 1m 10.47.255.234 ip-172-31-4-44.ap-northeast-1.compute.internal reviews-v2-5f69f77764-kf784 2/2 Running 0 1m 10.47.255.233 ip-172-31-4-44.ap-northeast-1.compute.internal reviews-v3-6f64f77457-fmqdx 2/2 Running 0 1m 10.47.255.232 ip-172-31-4-44.ap-northeast-1.compute.internal [root@ip-172-31-10-93 istio-1.0.5]# ※ 各 pod で2つのコンテナが起動していることを確認する (アプリケーションコンテナと envoy コンテナ)
この後、istio-ingress への external-ip の払い出しのため、以下のリンクと同様に、 gatewayless による floating-ip の設定を行う。
http://aaabbb-200904.hatenablog.jp/entry/2019/02/03/195348
※ kubemanager にコンテナ外で設定を行う場合、以下で実施することも可能 # tail /etc/contrail/common_kubemanager.env (snip) KUBERNETES_PUBLIC_FIP_POOL={'domain': 'default-domain', 'project': 'k8s-default', 'network': 'public-network1', 'name': 'default' } # # docker-compose -f /etc/contrail/kubemanager/docker-compose.yaml down # docker-compose -f /etc/contrail/kubemanager/docker-compose.yaml up -d
floating-ip の設定が終わったら、istio経由の外部アクセスを提供するため、istio-ingress のインストールを行う。
$ kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml $ kubectl get gateway [root@ip-172-31-10-93 istio-1.0.5]# kubectl get gateway -o wide NAME AGE bookinfo-gateway 17s [root@ip-172-31-10-93 istio-1.0.5]# $ kubectl get svc --all-namespaces -o wide [root@ip-172-31-10-93 istio-1.0.5]# kubectl get svc --all-namespaces -o wide NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR default details ClusterIP 10.108.145.18 <none> 9080/TCP 5m app=details default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 17m <none> default productpage ClusterIP 10.106.227.189 <none> 9080/TCP 5m app=productpage default ratings ClusterIP 10.107.149.71 <none> 9080/TCP 5m app=ratings default reviews ClusterIP 10.109.60.194 <none> 9080/TCP 5m app=reviews istio-system grafana ClusterIP 10.98.191.116 <none> 3000/TCP 9m app=grafana istio-system istio-citadel ClusterIP 10.105.46.119 <none> 8060/TCP,9093/TCP 9m istio=citadel istio-system istio-egressgateway ClusterIP 10.99.227.1 <none> 80/TCP,443/TCP 9m app=istio-egressgateway,istio=egressgateway istio-system istio-galley ClusterIP 10.97.53.49 <none> 443/TCP,9093/TCP 9m istio=galley istio-system istio-ingressgateway LoadBalancer 10.107.161.49 10.0.11.3 80:31380/TCP,443:31390/TCP,31400:31400/TCP,15011:31245/TCP,8060:32417/TCP,853:31014/TCP,15030:32577/TCP,15031:31476/TCP 9m app=istio-ingressgateway,istio=ingressgateway istio-system istio-pilot ClusterIP 10.107.3.44 <none> 15010/TCP,15011/TCP,8080/TCP,9093/TCP 9m istio=pilot istio-system istio-policy ClusterIP 10.107.98.144 <none> 9091/TCP,15004/TCP,9093/TCP 9m istio-mixer-type=policy,istio=mixer istio-system istio-sidecar-injector ClusterIP 10.96.59.151 <none> 443/TCP 9m istio=sidecar-injector istio-system istio-telemetry ClusterIP 10.98.180.42 <none> 9091/TCP,15004/TCP,9093/TCP,42422/TCP 9m istio-mixer-type=telemetry,istio=mixer istio-system jaeger-agent ClusterIP None <none> 5775/UDP,6831/UDP,6832/UDP 9m app=jaeger istio-system jaeger-collector ClusterIP 10.111.92.176 <none> 14267/TCP,14268/TCP 9m app=jaeger istio-system jaeger-query ClusterIP 10.110.71.53 <none> 16686/TCP 9m app=jaeger istio-system prometheus ClusterIP 10.106.27.29 <none> 9090/TCP 9m app=prometheus istio-system servicegraph ClusterIP 10.108.204.215 <none> 8088/TCP 9m app=servicegraph istio-system tracing ClusterIP 10.98.103.145 <none> 80/TCP 9m app=jaeger istio-system zipkin ClusterIP 10.109.197.58 <none> 9411/TCP 9m app=jaeger kube-system kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP 17m k8s-app=kube-dns kube-system kubernetes-dashboard ClusterIP 10.105.122.165 <none> 443/TCP 16m k8s-app=kubernetes-dashboard [root@ip-172-31-10-93 istio-1.0.5]# ※ istio-ingressgateway に external-ip が付いていることを確認する。
istio-ingressgateway が構成出来た後、上記の external-ip にアクセスを行い、以下の3画面 (review-1, review-2, review-3) にアクセスできることを確認している。
※ デフォルトの動作では、3画面に順次割り振りが行われる
アクセスできることを確認した後、以下のリンクの通り、virtual-service の適用を行い、envoy によって割り振り制御が行われることを確認できている。
(設定を投入してから切り替わるまで、最大1-2分程度かかった)
https://istio.io/docs/examples/intelligent-routing/
https://istio.io/docs/tasks/traffic-management/request-routing/
https://istio.io/docs/tasks/traffic-management/traffic-shifting/
$ kubectl apply -f samples/bookinfo/networking/destination-rule-all.yaml $ kubectl get destinationrules -o yaml $ kubectl apply -f samples/bookinfo/networking/virtual-service-all-v1.yaml $ kubectl get virtualservices -o yaml -> review-1 (文字のみの画面) だけに割り振りが行われる。 $ kubectl apply -f samples/bookinfo/networking/virtual-service-reviews-test-v2.yaml -> review-1 だけにアクセスが行われるが、jason という名前でログインした場合、 review-2 (黒い星の画面) に割り振りが行われる。 $ kubectl delete -f samples/bookinfo/networking/virtual-service-reviews-test-v2.yaml $ kubectl apply -f samples/bookinfo/networking/virtual-service-reviews-50-v3.yaml -> review-1, review-3 (文字のみの画面 / 赤い星の画面) に 50% ずつ割り振りが行われる。