概要
軽量Kubernetesであるk3sにサービスメッシュIstioを適用する。
結論としては、失敗している。
→multipasのメモリ、CPU割り当てを増やす事でインストールの確認までできている。
環境
- OS : osx multipass上で動作するUbuntu
- k3s : 最新を取得(v1.22.5+k3s1)
- Istio : 最新を取得(istio-1.12.1)
手順
- osxのターミナル上で、multipassによりubuntuを起動させ、シェルを起動する
- multipass launch -n k3s-master --cpus 2 --mem 4g ※デフォルトだと1cpu、1memで作成されリソース不足になるので注意
- multipass shell k3s-master
-
k3sをインストールする
- curl -sfL https://get.k3s.io | sh -s - server --disable traefik
[INFO] Using v1.22.5+k3s1 as release [INFO] systemd: Starting k3s
- sudo chmod 775 /etc/rancher/k3s/k3s.yaml
- mkdir ~/.kube
- cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
※Istioがk3sにアクセスできるように、configファイルを移動する。
- curl -sfL https://get.k3s.io | sh -s - server --disable traefik
-
istioをインストールする
- curl -L https://istio.io/downloadIstio | sh -
Downloading istio-1.12.1 from https://github.com/istio/istio/releases/download/1.12.1/istio-1.12.1-linux-amd64.tar.gz ... Istio 1.12.1 Download Complete! Istio has been successfully downloaded into the istio-1.12.1 folder on your system.
- export PATH="$PATH:/home/ubuntu/istio-1.12.1/bin"
- istioctl version
client version: 1.12.1 control plane version: 1.12.1 data plane version: 1.12.1 (2 proxies)
- istioctl x precheck
✔ No issues found when checking the cluster. Istio is safe to install or upgrade! To get started, check out https://istio.io/latest/docs/setup/getting-started/
- istioctl install --set profile=demo
✔ Istio core installed ✔ Istiod installed ✔ Egress gateways installed ✔ Ingress gateways installed ✔ Installation complete Making this installation the default for injection and validation. Thank you for installing Istio 1.12. Please take a few minutes to tell us about your install/upgrade experience! https://forms.gle/FegQbc9UvePd4Z9z7
- kubectl -n istio-system get all
NAME READY STATUS RESTARTS AGE pod/istiod-76d66d9876-fkmjh 1/1 Running 0 2m50s pod/svclb-istio-ingressgateway-jp59n 5/5 Running 0 2m14s pod/istio-ingressgateway-78f69bd5db-zwkvb 1/1 Running 0 2m15s pod/istio-egressgateway-687f4db598-jjfj7 1/1 Running 0 2m15s
- curl -L https://istio.io/downloadIstio | sh -
-
サンプルアプリケーションをデプロイ
- kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
service/details created serviceaccount/bookinfo-details created deployment.apps/details-v1 created service/ratings created serviceaccount/bookinfo-ratings created deployment.apps/ratings-v1 created service/reviews created serviceaccount/bookinfo-reviews created deployment.apps/reviews-v1 created deployment.apps/reviews-v2 created deployment.apps/reviews-v3 created service/productpage created serviceaccount/bookinfo-productpage created deployment.apps/productpage-v1 created
- kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.43.0.1 443/TCP 5m36s details ClusterIP 10.43.250.211 9080/TCP 24s ratings ClusterIP 10.43.128.103 9080/TCP 24s reviews ClusterIP 10.43.252.163 9080/TCP 23s productpage ClusterIP 10.43.12.119 9080/TCP 23s
- kubectl get pods
NAME READY STATUS RESTARTS AGE ratings-v1-b6994bb9-tfcth 0/2 PodInitializing 0 42s details-v1-79f774bdb9-btrng 0/2 PodInitializing 0 43s reviews-v1-545db77b95-f69kc 0/2 PodInitializing 0 42s reviews-v2-7bf8c9648f-z4sgl 0/2 PodInitializing 0 42s reviews-v3-84779c7bbc-cjtcj 0/2 PodInitializing 0 42s productpage-v1-6b746f74dc-p76xs 0/2 PodInitializing 0 41s
- kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml