LoginSignup
11
9

More than 5 years have passed since last update.

Istio をインストールしてみたが動かない

Posted at

Istio をインストールしてみたけど、動作しなかったときのメモです。

Istio ってなに?

モノリシック (monolithic) なアプリケーションを、より小さいサービス(マイクロサービス)に分解すればするほどサービスが増大し、
サービスメッシュ(service mesh: 網の目上になっているサービス間のインタラクション)が大きく、複雑になっていきます。
それにつれて、マイクロサービスおよび、マイクロサービス間の通信を監視、管理するのが困難になってきます。

Istio は モニリシックなアプリケーションを、
マイクロサービスアーキテクチャに基づいてマイクロサービスとして構成したときに
直面する課題を解決するためのプラットフォームです。

直面する課題とは、例えば以下のようなものです。

  • ロードバランシング
  • フェイルオーバー
  • ルーティング制御
  • レート制御
  • サービス間認証
  • etc

ちなみに、Istio(イスティオ)はギリシャ語で、日本語では「 」、英語では「sail」に相当する単語みたいです。

アーキテクチャ

Istio は data plane と control plane で構成されています。
ここの動画がわかりやすいです。

data plane

サービスの集合です。サービスには Envoy と呼ばれるプロキシが前段に置かれています(サイドカーとして取り付けられています)。サービス宛てのリクエストはすべて Envoy が処理します。Envoy にはロードバランシングなどの多くの機能を備えていて、これにより、サービスを変更することなく上記の課題を解決することができます。

control plane

Envoy を制御するものです。control plane から Envoy の動作変更などを指示します。

architecture

インストール

早速インストールしてみたのですが、僕の環境では動作しませんでした。何か見落としがあるのかもしれません。以下はインストールしたときのメモです。

以下の記事で Kubernetes をクラスター構成していることを前提にしています。

環境設定

ホストマシンから master にログインして、
kubectl をユーザー kube から実行できるように環境を設定します。

  1. master にログインする
  2. 環境変数 KUBERCONFIG を設定する。
  3. .bash_profile に KUBECONFIG を設定する(オプション)
$ ssh kube@192.168.121.9
kube@192.168.121.9's password: kube
$ sudo cp /etc/kubernetes/admin.conf $HOME/
[sudo] password for kube: kube
$ sudo cp /etc/kubernetes/admin.conf $HOME/
$ sudo chown $(id -u):$(id -g) $HOME/admin.conf
$ export KUBECONFIG=$HOME/admin.conf

何度も KUBECONFIG を設定するのが面倒なときは、.bash_profile にも設定しておきます。

$ echo 'export KUBECONFIG=$HOME/admin.conf' >> ~/.bash_profile

仮想ディスクの拡張

10GB の仮想ディスクでは足りない感じなので、10GB 拡張します。以下を参考に
master,minion-1,minion-2,minion-3 の仮想ディスクを拡張します。

Istio のインストール

インストール手順は次のとおりです。

  1. Istio のダウンロード
  2. PATH の設定
  3. ロールの追加
  4. Core コンポーネントのインストール

Istio をダウンロードします。
ここでは /root にダウンロードして展開し、実行パスを設定します。

# cd /root
# curl -L https://git.io/getIstio | sh -

実行パスを設定します。.bash_profile にも設定を追加しておきます。

# echo 'export PATH=$PATH:/root/istio/istio-0.1.5/bin' >> ~/.bash_profile
# export PATH=$PATH:/root/istio/istio-0.1.5/bin

ロールを設定します。RBAC は alpha と beta が設定されているはずなので、beta の設定をします。
alpha しか設定されていないときは istio-rbac-beta.yaml を使用します。どちらも設定されていなければ操作は不要です。

# cd /root/istio/istio-0.1.5
# kubectl api-versions | grep rbac
rbac.authorization.k8s.io/v1alpha1
rbac.authorization.k8s.io/v1beta1
# kubectl apply -f install/kubernetes/istio-rbac-beta.yaml
clusterrole "istio-manager" created
clusterrole "istio-ca" created
clusterrole "istio-sidecar" created
rolebinding "istio-manager-admin-role-binding" created
rolebinding "istio-ca-role-binding" created
rolebinding "istio-ingress-admin-role-binding" created
rolebinding "istio-sidecar-role-binding" created

Core コンポーネントをインストールします。認証の有無を選択できます。
ここでは認証ありでインストールします。以下のコンポーネントがインストールされます。
* ca
* egress
* ingress
* manager
* mixer

# kubectl apply -f install/kubernetes/istio-auth.yaml 
service "istio-mixer" created
deployment "istio-mixer" created
configmap "istio" created
service "istio-manager" created
serviceaccount "istio-manager-service-account" created
deployment "istio-manager" created
service "istio-ingress" created
serviceaccount "istio-ingress-service-account" created
deployment "istio-ingress" created
service "istio-egress" created
deployment "istio-egress" created
serviceaccount "istio-ca-service-account" created
deployment "istio-ca" created

インストールの確認

ここで pod がインストールされていること確認します。

僕の環境では Error が発生してインストールできていないようです。
以下の 3 つの pod が Runinng、Error を繰り返しています。

  • istio-egress
  • istio-ingress
  • istio-manager
# kubectl get pods --all-namespaces
NAMESPACE     NAME                                    READY     STATUS    RESTARTS   AGE
default       istio-ca-3887035158-bqfkr               1/1       Running   0          1m
default       istio-egress-1920226302-ssqs9           0/1       Error     0          1m
default       istio-ingress-2112208289-6rrx0          1/1       Running   0          1m
default       istio-manager-2910860705-64g50          1/2       Error     0          1m
default       istio-mixer-2335471611-bhgr7            1/1       Running   0          1m
kube-system   etcd-centos-master                      1/1       Running   12         12d
kube-system   kube-apiserver-centos-master            1/1       Running   11         12d
kube-system   kube-controller-manager-centos-master   1/1       Running   22         12d
kube-system   kube-dns-3913472980-6qlgm               3/3       Running   33         12d
kube-system   kube-proxy-1g22c                        1/1       Running   9          12d
kube-system   kube-proxy-27c8w                        1/1       Running   7          12d
kube-system   kube-proxy-29q4c                        1/1       Running   7          12d
kube-system   kube-proxy-7qwjg                        1/1       Running   12         12d
kube-system   kube-scheduler-centos-master            1/1       Running   23         12d
kube-system   kubernetes-dashboard-2039414953-d062r   1/1       Running   7          10d
kube-system   weave-net-0dvs3                         2/2       Running   24         12d
kube-system   weave-net-kjlj5                         2/2       Running   20         12d
kube-system   weave-net-pvqf3                         2/2       Running   17         12d
kube-system   weave-net-wdpbh                         2/2       Running   24         12d
#

原因調査中です... dashboard から egress のログを見てみると、IstioConfig is not ready と言ってますね。何かのコマンドも実行できていない感じです。

 I0610 00:38:53.065597       1 client.go:205] TPR "IstioConfig" is not ready (User "system:serviceaccount:default:default" cannot list istioconfigs.istio.io at the cluster scope. (get IstioConfigs.istio.io)). Waiting...
I0610 00:38:54.070192       1 client.go:205] TPR "IstioConfig" is not ready (User "system:serviceaccount:default:default" cannot list istioconfigs.istio.io at the cluster scope. (get IstioConfigs.istio.io)). Waiting...
I0610 00:38:55.075182       1 client.go:205] TPR "IstioConfig" is not ready (User "system:serviceaccount:default:default" cannot list istioconfigs.istio.io at the cluster scope. (get IstioConfigs.istio.io)). Waiting...
I0610 00:38:56.085495       1 client.go:205] TPR "IstioConfig" is not ready (User "system:serviceaccount:default:default" cannot list istioconfigs.istio.io at the cluster scope. (get IstioConfigs.istio.io)). Waiting...
Error: 2 errors occurred:
* failed to register Third-Party Resources. User "system:serviceaccount:default:default" cannot get thirdpartyresources.extensions at the cluster scope. (get thirdpartyresources.extensions istio-config.istio.io)
* failed to register Third-Party Resources. Failed to create all TPRs
Usage:
  manager proxy egress [flags]
Global Flags:
      --domainSuffix string              Kubernetes DNS domain suffix (default "cluster.local")
      --ipAddress string                 IP address. If not provided uses ${POD_IP} environment variable.
      --kubeconfig string                Use a Kubernetes configuration file instead of in-cluster configuration
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --meshConfig string                ConfigMap name for Istio mesh configuration, config key should be "mesh" (default "istio")
  -n, --namespace string                 Select a namespace for the controller loop. If not set, uses ${POD_NAMESPACE} environment variable
      --podName string                   Pod name. If not provided uses ${POD_NAME} environment variable
      --resync duration                  Controller resync interval (default 1s)
  -v, --v Level                          log level for V logs (default 0)
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging
E0610 00:38:57.092114       1 main.go:247] 2 errors occurred:
* failed to register Third-Party Resources. User "system:serviceaccount:default:default" cannot get thirdpartyresources.extensions at the cluster scope. (get thirdpartyresources.extensions istio-config.istio.io)
* failed to register Third-Party Resources. Failed to create all TPRs
Logs from 6/10/17 12:38 AM to 6/10/17 12:38 AM

参考

https://istio.io/docs/concepts/what-is-istio/overview.html#why-use-istio
https://developer.ibm.com/dwblog/2017/istio/
https://www.amalgam8.io/?cm_mc_uid=31334323488914922601810&cm_mc_sid_50200000=1497022187

11
9
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
11
9