Upgrade to Pro — share decks privately, control downloads, hide ads and more …

VMとAWS ECSがメインのインフラにKubernetesを導入した効能

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for Dorian Dorian
June 13, 2020

VMとAWS ECSがメインのインフラにKubernetesを導入した効能

Avatar for Dorian

Dorian

June 13, 2020
Tweet

More Decks by Dorian

Other Decks in Technology

Transcript

  1. コンテナ及びサーバーレスの導⼊状況 • サムネイル画像⽣成 • タイムライン⽣成 • 配信基盤のECSイベント受信 • 監視および監視の有効無効切り替え •

    配信基盤 • 低遅延プロキシ • サーバーサイドレンダリングバックエンド 約100以上の関数 ピーク時1Kコンテナ以上稼働
  2. Kubernetesを導⼊するモチベーション OPENREC.tv リリース当初の使⽤技術 • CentOS 6.4 • PHP 5.6 •

    Node 0.10.36 • Apache HTTP Server 2.2 • MySQL 5.5 • Redis 2.0 • 固定ホストなEC2
  3. Kubernetesを導⼊するモチベーション OPENREC.tv 現在の利⽤技術 • AmazonLinux1and2/CentOS7/CentOS6 • EC2 with AutoScale •

    ECS • Kubernetes • Docker19.03/18.03/17.03 • PHP7 • Apache HTTP Server 2.4 • Nginx1.14~1.17 • Node10~13(TypeScript2.x) • Java8 • Kotlin • golang 1.10~1.13 • Amazon Aurora • DynamoDB • Redis 2.0~4.0 • Redshift
  4. バックエンド(BFF like)サービスとして構成 ネイティブクライアント⽤レスポンス PC(web)⽤レスポンス user api contents api auth api

    stamp api point api etc. Backends For Frontendsの略。 ここではクライアントに対して複数のAPIを束ねて 1つのAPIレスポンスとして返すサーバーという意味で使⽤ 既存API 新規API
  5. user api contents api auth api stamp api point api

    etc. バックエンドサービスが死んでいたとしても BFF側で何らかのレスポンスを返せる バックエンド(BFF like)サービスの利点 レスポンスこないな。。 ひとまずデフォルト値を返そう
  6. 稼働しているサービスの紹介 • バックエンドサービス3つ • ALB Ingress Controller • ExternalDNS •

    AgroCD • Fluentd • Fluent Bit • Kube-Prometheus • Horizontal Pod Autoscaler • Cluster Autoscaler • Metrics-server • Kubernetes Dashboard
  7. 稼働しているサービスの紹介 バックエンドサービス • 使⽤⾔語: Kotlin • 使⽤フレームワーク: Ktor • メモリのlimit,

    requestは4096MiBで設定 • CPUは4000mCPU = 4コア割当 • application.ymlはdeployment.ymlのargsディレクティブで指定
  8. 考慮しなきゃいけないこと • ネットワーク(VPC)設計 • 性能検証 • 構成管理 • デプロイ(CI/CD) •

    障害対応など 当たり前だが⼀⼈で担当できる量ではない。。 SREチームで分担して担当
  9. 直⾯した問題たち(SQL発⾏されすぎ問題) Issue: https://github.com/JetBrains/Exposed/issues/306 I'm not sure that using Exposed's transactions

    with auto-commit is a good idea because in that case, we shouldn't use built-in Entity cache or we can see the wrong state of entities. Exposedのトランザクションをオートコミットで使うのは、その場合は組み込みの Entityキャッシュを使うべきではないし、間違った状態のEntityを⾒てしまうこともあるので、 あまりいい考えではないと思います。