LoginSignup
1
0

More than 1 year has passed since last update.

minikubeへIstioをインストール&デモWebアプリをデプロイ

Last updated at Posted at 2021-07-19

環境

  • minikube v1.22.0
  • Istio 1.10.3
  • Docker 20.10.2
  • Ubuntu 18.04
    • RAM: 4GB
    • SSD 30GB
    • CPU v2Core

手順

Istioが使えるメモリが4GBとれるように,VMのメモリを6GBに増やす.

Istio本体の起動には2Gで十分なのですが、BookInfoの動作には4G以上のメモリが必要なことに注意してください。

参考URL) https://qiita.com/Ladicle/items/e949b0f68ac18b7a95d8

minikubeを一度消す.

$ minikube delete

minikubeを4096mbのメモリで起動する.

$ minikube start --memory=4096 --cpus=2

Istioをダウンロードする.

$ curl -L https://istio.io/downloadIstio | sh -
$ cd istio-1.10.3
$ export PATH=$PWD/bin:$PATH

Istioをインストールする.

$ istioctl install --set profile=demo -y
$ kubectl label namespace default istio-injection=enabled

サンプルアプリをデプロイする.

$ pwd
/home/koyama/istio-1.10.3
$ kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml

デプロイできているか確認する.

$ kubectl get svc
NAME          TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
details       ClusterIP   10.102.37.85     <none>        9080/TCP   74s
kubernetes    ClusterIP   10.96.0.1        <none>        443/TCP    15h
productpage   ClusterIP   10.103.190.110   <none>        9080/TCP   74s
ratings       ClusterIP   10.100.108.5     <none>        9080/TCP   74s
reviews       ClusterIP   10.101.220.149   <none>        9080/TCP   74s

$ kubectl get pods
NAME                              READY   STATUS    RESTARTS   AGE
details-v1-79f774bdb9-m8q5w       2/2     Running   0          53s
productpage-v1-6b746f74dc-wlv2x   2/2     Running   0          53s
ratings-v1-b6994bb9-fn9z6         2/2     Running   0          53s
reviews-v1-545db77b95-pt62r       2/2     Running   0          53s
reviews-v2-7bf8c9648f-qwglq       2/2     Running   0          53s
reviews-v3-84779c7bbc-frs8t       2/2     Running   0          53s

以下のコマンドでデモ用Webアプリケーションの動作を確かめる.

$ kubectl exec "$(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl -sS productpage:9080/productpage | grep -o "<title>.*</title>"

<title>Simple Bookstore App</title>

クラスタ外からアクセスしてみる.以下の図はポート転送設定の概要を表す.

技術系ポンチ絵(1).png

Kubernetesクラスタのサービス producpage が提供するポート9080を,localhostのポート3300に公開する.

$ kubectl port-forward svc/productpage 3300:9080

上記コマンドとは別でシェルを立ち上げる.
手元にあるラップトップのポート3210をKubernetesクラスタのポート3300に転送する.

$ ssh -L 3210:localhost:3300 koyama-k8s

Webブラウザからlocalhostのポート 3210へアクセスする.

bookinfo-top.png

bookinfo-subpage.png

デプロイしたWebアプリケーションの詳細は以下にある.

カスタマイズ方法は以下にある.

BookinfoデモでIstioを体感する | Think IT(シンクイット)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0