朝活_20200910

やったこと

# ceph dashboard
$ kubectl apply -f rook/cluster/examples/kubernetes/ceph/dashboard-loadbalancer.yaml
$ kubectl -n rook-ceph get secret rook-ceph-dashboard-password -o jsonpath="{['data']['password']}" | base64 --decode && echo
MetalLB で払い出された Exernal IP にブラウザでアクセス
[f:id:nnstt1:20200910063407p:plain]
  • ArgoCD CLI ツール インストール
# argocd cli
    $ VERSION=$(curl --silent "https://api.github.com/repos/argoproj/argo-cd/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
    $ sudo curl -SL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64
    $ sudo chmod +x /usr/local/bin/argocd
    </code></pre>
    admin パスワード変更
    <pre style="background-color: rgb(40, 44, 52) !important;"><code class="bash"># change admin pass
    $ kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2
    $ argocd login <Exernal IP>
    $ argocd account update-password
Web Console ログイン
[f:id:nnstt1:20200910064509p:plain]
サンプルアプリ デプロイ
[f:id:nnstt1:20200910065126p:plain]
[f:id:nnstt1:20200910065153p:plain]
[f:id:nnstt1:20200910065216p:plain]

うまく動かず…

[f:id:nnstt1:20200910065430p:plain]
  • Istio インストール
    $ curl -L https://istio.io/downloadIstio | sh -
    $ cd istio-1.7.0
    $ export PATH="$PATH:/home/nnstt1/istio/istio-1.7.0/bin"
    $ istioctl x precheck
    $ istioctl install --set profile=demo
    $ kubectl label namespace default istio-injection=enabled
サンプルアプリ デプロイ
# sample
    $ kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
    $ kubectl exec "$(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl -s productpage:9080/productpage | grep -o "<title>.*</title>"
    $ kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
    $ istioctl analyze
    Warn [IST0103] (Pod busybox-sleep-less.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.
    Warn [IST0103] (Pod busybox-sleep.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.
    Warn [IST0103] (Pod wordpress-7b989dbf57-6956z.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.
    Warn [IST0103] (Pod wordpress-mysql-6965fc8cc8-k76t4.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.
    Info [IST0118] (Service wordpress.default) Port name  (port: 80, targetPort: 80) doesn't follow the naming convention of Istio port.
    Error: Analyzers found issues when analyzing namespace: default.
    See https://istio.io/docs/reference/config/analysis for more information about causes and resolutions.

わかったこと

  • ArgoCD がそのままでは動かない
    • kubectl logs -f -n argocd argocd-server-xxxx でログを見ても、エラー内容をよくわかっていない
  • Istio の概要はわかっていても使い方を把握できていない

次にやること

  • ArgoCD サンプルアプリを動くようにする

やり残し

  • Grafana Dashboard インポートできない事象の調査
  • Istio の使い方を調べる

参照したリンク

Rook Docs

Getting Started - Argo CD - Declarative GitOps CD for Kubernetes

Istio / Getting Started

追記

今日の記録を Twitter に流したところ、@zaki_hmkc さんから Istio のことについて教えていただきました!ありがとうございます!

Pod 削除前

Istio 入れる前から動かしていた namespace: default の Pod たちで Warn が出ています。

$ kubectl get pods
NAME                               READY   STATUS    RESTARTS   AGE
busybox-sleep                      1/1     Running   0          26h
busybox-sleep-less                 1/1     Running   94         26h
details-v1-79c697d759-hb47t        2/2     Running   0          87m
productpage-v1-65576bb7bf-lr2tx    2/2     Running   0          87m
ratings-v1-7d99676f7f-nd8hr        2/2     Running   0          87m
reviews-v1-987d495c-w7png          2/2     Running   0          87m
reviews-v2-6c5bf657cf-98dnp        2/2     Running   0          87m
reviews-v3-5f7b9f4f77-tr4j9        2/2     Running   0          87m
wordpress-7b989dbf57-6956z         1/1     Running   0          3d1h
wordpress-mysql-6965fc8cc8-k76t4   1/1     Running   0          3d1h

$ istioctl analyze
Warn [IST0103] (Pod busybox-sleep-less.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.
Warn [IST0103] (Pod busybox-sleep.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.
Warn [IST0103] (Pod wordpress-7b989dbf57-6956z.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.
Warn [IST0103] (Pod wordpress-mysql-6965fc8cc8-k76t4.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.
Info [IST0118] (Service wordpress.default) Port name  (port: 80, targetPort: 80) doesn't follow the naming convention of Istio port.
Error: Analyzers found issues when analyzing namespace: default.
See https://istio.io/docs/reference/config/analysis for more information about causes and resolutions.

WordPress Pod 削除

Rook のサンプルとして使っていた WordPress Pod を削除してみます。

$ kubectl delete pods wordpress-7b989dbf57-6956z
pod "wordpress-7b989dbf57-6956z" deleted

$ kubectl get pods
NAME                               READY   STATUS    RESTARTS   AGE
busybox-sleep                      1/1     Running   0          26h
busybox-sleep-less                 1/1     Running   94         26h
details-v1-79c697d759-hb47t        2/2     Running   0          87m
productpage-v1-65576bb7bf-lr2tx    2/2     Running   0          87m
ratings-v1-7d99676f7f-nd8hr        2/2     Running   0          87m
reviews-v1-987d495c-w7png          2/2     Running   0          87m
reviews-v2-6c5bf657cf-98dnp        2/2     Running   0          87m
reviews-v3-5f7b9f4f77-tr4j9        2/2     Running   0          87m
wordpress-7b989dbf57-rwwqb         2/2     Running   0          16s <- READY が 2/2 になった(削除前は 1/1)
wordpress-mysql-6965fc8cc8-k76t4   1/1     Running   0          3d1h

$ istioctl analyze
Warn [IST0103] (Pod busybox-sleep-less.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.
Warn [IST0103] (Pod busybox-sleep.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.
Warn [IST0103] (Pod wordpress-mysql-6965fc8cc8-k76t4.default) The pod is missing the Istio proxy. This can often be resolved by restarting or redeploying the workload.        <- wordpress-7b989dbf57-6956z の Warn がなくなった
Info [IST0118] (Service wordpress.default) Port name  (port: 80, targetPort: 80) doesn't follow the naming convention of Istio port.
Error: Analyzers found issues when analyzing namespace: default.
See https://istio.io/docs/reference/config/analysis for more information about causes and resolutions.

サイドカーとして istio-proxy コンテナが WordPress Pod 内で立ち上がったようです。

Pod 全削除

Warn となっていた他の Pod も削除してみました。 busybox のPod は Deployment で起動したものでは無いため、失くなってしまいました。 (restart ではなく delete してしまいました。。)

$ kubectl delete pods busybox-sleep busybox-sleep-less wordpress-mysql-6965fc8cc8-k76t4
pod "busybox-sleep" deleted
pod "busybox-sleep-less" deleted
pod "wordpress-mysql-6965fc8cc8-k76t4" deleted

$ kubectl get pods
NAME                               READY   STATUS    RESTARTS   AGE
details-v1-79c697d759-hb47t        2/2     Running   0          102m
productpage-v1-65576bb7bf-lr2tx    2/2     Running   0          102m
ratings-v1-7d99676f7f-nd8hr        2/2     Running   0          102m
reviews-v1-987d495c-w7png          2/2     Running   0          102m
reviews-v2-6c5bf657cf-98dnp        2/2     Running   0          102m
reviews-v3-5f7b9f4f77-tr4j9        2/2     Running   0          102m
wordpress-7b989dbf57-rwwqb         2/2     Running   0          14m
wordpress-mysql-6965fc8cc8-t7s92   2/2     Running   0          12m <- READY が 2/2 になった(削除前は 1/1)

$ istioctl analyze
Info [IST0118] (Service wordpress.default) Port name  (port: 80, targetPort: 80) doesn't follow the naming convention of Istio port.

無事に Warn は出なくなりました。

Info メッセージが出ていますが、時間がないのはこれはまた後日確認します。。