Sockshopの概要

アーキテクチャ

https://blog.mosuke.tech/entry/2020/01/22/sockshop/

kubectlの結果

$ kubectl get deploy
NAME           READY   UP-TO-DATE   AVAILABLE   AGE
payment        1/1     1            1           38h
carts-db       1/1     1            1           38h
orders-db      1/1     1            1           38h
rabbitmq       1/1     1            1           38h
session-db     1/1     1            1           38h
user-db        1/1     1            1           38h
carts          1/1     1            1           38h
catalogue      1/1     1            1           38h
front-end      1/1     1            1           38h
queue-master   1/1     1            1           38h
user           1/1     1            1           38h
catalogue-db   1/1     1            1           38h
orders         1/1     1            1           38h
shipping       1/1     1            1           38h

$ kubectl get svc
NAME           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
carts          ClusterIP   10.43.145.84    <none>        80/TCP              38h
carts-db       ClusterIP   10.43.34.75     <none>        27017/TCP           38h
catalogue      ClusterIP   10.43.215.69    <none>        80/TCP              38h
catalogue-db   ClusterIP   10.43.209.191   <none>        3306/TCP            38h
front-end      NodePort    10.43.136.75    <none>        80:30001/TCP        38h
orders         ClusterIP   10.43.142.135   <none>        80/TCP              38h
orders-db      ClusterIP   10.43.189.146   <none>        27017/TCP           38h
payment        ClusterIP   10.43.187.123   <none>        80/TCP              38h
queue-master   ClusterIP   10.43.177.129   <none>        80/TCP              38h
rabbitmq       ClusterIP   10.43.10.106    <none>        5672/TCP,9090/TCP   38h
session-db     ClusterIP   10.43.39.27     <none>        6379/TCP            38h
shipping       ClusterIP   10.43.98.65     <none>        80/TCP              38h
user           ClusterIP   10.43.253.169   <none>        80/TCP              38h
user-db        ClusterIP   10.43.225.82    <none>        27017/TCP           38h

ログの取得

Deploymentごとにログを書き出し

for x in $(kubectl get deploy  | grep -v "\-db" | awk '$1 ~ /[a-z]+/ {print $1}'); 
do 
  kubectl logs deploy/$x -c istio-proxy > $x.log; 
done

結果

$ ls *.log | xargs -l

carts.log
catalogue.log
front-end.log
orders.log
payment.log
queue-master.log
rabbitmq.log
shipping.log
user.log

HTTPのログだけに絞る

for x in $(ls *.log); 
do
  fname=$(echo $x | sed 's/.log//g'); 
  grep HTTP $x > ${fname}.http;
done

HTTPのログを作成した

$ ls *.http | xargs -l

carts.http
catue.http
front-end.http
orders.http
payment.http
queue-master.http
rabbitmq.http
shipping.http
user.http

ログをダウンロードする.

rsync -avrz koyama-sockshop:~/logs .

確認する.

ls logs
carts.http		front-end.http		payment.http		rabbitmq.http		user.http
carts.log		front-end.log		payment.log		rabbitmq.log		user.log
catalogue.log		orders.http		queue-master.http	shipping.http
catue.http		orders.log		queue-master.log	shipping.log

バッチリ(๑•̀ㅁ•́๑)✧