そこはかとなく

見て聞いて触ったことの技術メモ

Oracle Container Engine for Kubernetes(OKE)にIstio1.0.5をインストールしてみた

この記事について

Oracle Container Engine for Kubernetes(OKE)にIstio1.0.5をインストールする手順を記載します。

OKEクラスターの準備

Istioの公式ドキュメントにもOracle Cloud Infrastructureのセットアップ手順が記載されています。 f:id:scoto:20190114154538p:plain

Oracle Cloud Infrastructureテナント内にOKEクラスターを作成する最も簡単な方法は、Oracle Cloud InfrastructureのWebコンソールから「Quick Cluster」オプション(デフォルト)を使用する方法です。 僅か数クリックでOKEクラスターを構築することができます。

詳しくは OKEでKubernetesクラスターをプロビジョニングする - チャーリー!のテクメモ を参照してください。

OKEクラスターが作成できたら、OCI cliコマンドを実行してkubeconfigファイルをダウンロード、保存します。

$ oci ce cluster create-kubeconfig \
    --file $HOME/.kube/config \
    --cluster-id <cluster-ocid>

続いてユーザーにクラスタ管理者(admin)権限を与えます。Istioに必要なRBACルールを作成するには管理者権限が必要です。

$ kubectl create clusterrolebinding cluster-admin-binding \
    --clusterrole=cluster-admin \
    --user=<user_ocid>

Istioのインストール

Istio / Quick Start with Kubernetesに沿って作業します。

1.最新バージョンを以下コマンドでダウンロード

$ curl -L https://git.io/getLatestIstio | sh -

2.Istioのカスタムリソース定義を適用

$ kubectl apply -f install/kubernetes/helm/istio/templates/crds.yaml

3.LoadBalancerの定義を編集(任意)

今回はPod同士のTLS認証を有効にせずにIstioをインストールします。

LoadBalancerタイプのServiceオブジェクトに、Oracle Cloud Infrastructureのロードバランサーを利用するための記述を追加します。 マニフェストファイル install/kubernetes/istio-demo.yaml のL12485に記述を追加します。

12478 ---
12479 apiVersion: v1
12480 kind: Service
12481 metadata:
12482   name: istio-ingressgateway
12483   namespace: istio-system
12484   annotations:
12485     service.beta.kubernetes.io/oci-load-balancer-shape: 400Mbps

追加しない場合、デフォルトの定義(Shape:100Mbps)でOracle Cloud Infrastructureのロードバランサーが作成されます。

4.Istioの各定義を適用

編集したらマニフェストファイルを適用します。

$ kubectl apply -f install/kubernetes/istio-demo.yaml

確認

Pod を確認

$ kubectl get pods -n istio-system
NAME                                     READY   STATUS      RESTARTS   AGE
grafana-7f6cd4bf56-ggqj7                 1/1     Running     0          3d
istio-citadel-7dd558dcf-6frkq            1/1     Running     0          3d
istio-cleanup-secrets-bvt9s              0/1     Completed   0          3d
istio-egressgateway-88887488d-9cgcq      1/1     Running     0          3d
istio-galley-787758f7b8-zx7gb            1/1     Running     0          3d
istio-grafana-post-install-mj7r8         0/1     Completed   0          3d
istio-ingressgateway-58c77897cc-5h9cn    1/1     Running     0          3d
istio-pilot-86cd68f5d9-xvxs6             2/2     Running     0          3d
istio-policy-56c4579578-p7lgg            2/2     Running     0          3d
istio-security-post-install-4dz55        0/1     Completed   0          3d
istio-sidecar-injector-d7f98d9cb-xsbvx   1/1     Running     0          3d
istio-telemetry-7fb48dc68b-4sgmz         2/2     Running     0          3d
istio-tracing-7596597bd7-rtxfm           1/1     Running     1          3d
prometheus-76db5fddd5-fj6gl              1/1     Running     0          3d
servicegraph-56dddff777-r6wff            1/1     Running     1          3d

Service を確認

$ kubectl get service -n istio-system
NAME                     TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)                                                                                                                   AGE
grafana                  ClusterIP      10.96.215.232   <none>           3000/TCP                                                                                                                  3d
istio-citadel            ClusterIP      10.96.63.94     <none>           8060/TCP,9093/TCP                                                                                                         3d
istio-egressgateway      ClusterIP      10.96.50.97     <none>           80/TCP,443/TCP                                                                                                            3d
istio-galley             ClusterIP      10.96.198.43    <none>           443/TCP,9093/TCP                                                                                                          3d
istio-ingressgateway     LoadBalancer   10.96.225.198   129.XXX.XXX.XXX   80:31380/TCP,443:31390/TCP,31400:31400/TCP,15011:32084/TCP,8060:30266/TCP,853:32123/TCP,15030:31048/TCP,15031:30558/TCP   3d
istio-pilot              ClusterIP      10.96.51.162    <none>           15010/TCP,15011/TCP,8080/TCP,9093/TCP                                                                                     3d
istio-policy             ClusterIP      10.96.68.127    <none>           9091/TCP,15004/TCP,9093/TCP                                                                                               3d
istio-sidecar-injector   ClusterIP      10.96.160.21    <none>           443/TCP                                                                                                                   3d
istio-telemetry          ClusterIP      10.96.226.178   <none>           9091/TCP,15004/TCP,9093/TCP,42422/TCP                                                                                     3d
jaeger-agent             ClusterIP      None            <none>           5775/UDP,6831/UDP,6832/UDP                                                                                                3d
jaeger-collector         ClusterIP      10.96.245.242   <none>           14267/TCP,14268/TCP                                                                                                       3d
jaeger-query             ClusterIP      10.96.141.214   <none>           16686/TCP                                                                                                                 3d
jaeger-query-svc         ClusterIP      10.96.178.82    <none>           16686/TCP                                                                                                           3d
prometheus               ClusterIP      10.96.113.247   <none>           9090/TCP                                                                                                                  3d
servicegraph             ClusterIP      10.96.50.158    <none>           8088/TCP                                                                                                                  3d
tracing                  ClusterIP      10.96.29.192    <none>           80/TCP                                                                                                                    3d
zipkin                   ClusterIP      10.96.100.234   <none>           9411/TCP                                                                                                                  3d

全てのサービスが立ち上がっていることを確認します。

インストール作業はこれで完了です!

次回はIstioの機能をいろいろ試してみたいと思います。ご覧いただきありがとうございました。