Kubernetes Meetup Tokyo #26
Kubecon NA 2019 Recap:
Your Path to Production Ready Kubernetes hosted by Weaveworks
December 3, 2019
Tomohiro Tsuchida
Data Science & AI Department Supervisory Organization
Customer Support & Bot AI Section
AI Production Group
DevOps Team
Rakuten, Inc.
2
アジェンダ
• ⾃⼰紹介
• 業務との関わり
• Recap
• まとめ
3
⾃⼰紹介
名前: ⼟⽥ 智⼤ / Tomohiro Tsuchida
所属: 楽天株式会社 (2018/05 ~)
業務: AI 関連プロダクトの DevOps, インフラ, CI/CD 等
4
業務
• AIを活⽤したプロダクト、Chatbotとか
• 主に社内のk8sプラットフォームを利⽤する側
• ⼊社後初めてk8sを使う
• Developerの開発したアプリケーションをk8s上で動かせるように
• プロダクト開発プロセスに改善の余地があるのでは
• もともとDevとOpsが独⽴しすぎていた
• プロダクト数増加につれOpsがボトルネックに
5
Production Ready を⽬指して1年半ほどやってきたこと
• k8sクラスタ上のリソースを旧クラスタから新クラスタに移⾏
• 動いてないものを直す
• アプリケーションリポジトリ、マニフェストリポジトリの適切な分割
• 1プロジェクトに複数のプロダクトのリポジトリが存在していた
• マニフェストのリポジトリにDockerfileがあった
• Developer向けに
• DevOpsについて
• Dockerfileの書き⽅
• Kubernetes上でアプリケーションを動かす際の考慮
• サンプル実装提供
• k8sの基本的な概念
• 権限委譲
• kubectl使い⽅等ハンズオン
• CI/CD⽤にConcourse, Vault等の⽤意
• もともとJenkinsがあったが⾃分たちのチームの要件に合わせるため
6
Developerがプロアクティブに
• Dockerfile を改善
• イメージサイズ削減
• 例) 1.55GB から 38.8MB
• プロセス起動時間の削減
• 例) 起動 に6分かかっていたが 0.1秒程度に
• アプリケーションのconfigを最適化
• 例) nginx のconfigで圧縮設定を⼊れる
• モノリスなアプリケーションをマイクロサービスに分割
7
何をすべきなのか
• 漠然と
• Liveness/Readiness Probe
• Configmap
• Graceful shutdown
• Twelve-Factor App
• 何を考慮するべきなのかの指針が欲しい
8
機会
• 海外カンファレンスの機会を得る
• 初海外
• k8s使ってるしKubecon良いかも
• 初Kubecon
どうせなら
• Kubernetes Meetup Tokyo
• 初参加
• 社外でのスピーカー応募
• 初応募
• 社外での登壇
• 初登壇
9
https://kccncna19.sched.com/event/U1bS/your-path-to-production-ready-kubernetes-hosted-by-weaveworks-additional-registration-fee-required
10
Recap
11
ワークショップ概要
• タイトル: Your Path to Production Ready Kubernetes (hosted by
Weaveworks)
• 講師: Brice Fernandes / Weaveworks
• 形式: 解説 + ハンズオン形式
• ワークショップ資料: https://tinyurl.com/kubecon-2019-workshop
• これをシェアしたかった
12
ワークショップ内容
• Developing and operating your Kubernetes microservices at scale
• DevOps best practices and the movement towards a “GitOps” approach
• Building with Kubernetes in production: caring for your apps, implementing CI/CD
best practices, and utilizing the right metrics, monitoring tools, and automated
alerts
• Operating Kubernetes in production: Upgrading and managing Kubernetes,
managing incident response, and adhering to security best practices for
Kubernetes
https://kccncna19.sched.com/event/U1bS/your-path-to-production-ready-
kubernetes-hosted-by-weaveworks-additional-registration-fee-required
• Kubernetes上のアプリケーションからクラスタ、DevOpsのベストプラクティ
ス、セキュリティまで1⽇で
13
ワークショップ内容
“Created by Weaveworks / Derived from material create by Weaveworks. Original available at https://tinyurl.com/kubecon-2019-workshop”
14
https://twitter.com/weaveworks/status/1196612816473640961
15
https://twitter.com/weaveworks/status/1196612816473640961
16
ハンズオン
• WeaveCloudのトライアルアカウント
• GKE
• Github(任意のGitホスティングサービス)
• curlでスクリプト叩くだけでFlux agentなどがインストールされてWeave
Cloud上でダッシュボードが利⽤可能に
• とても簡単にGitOps環境が構築できた
• この環境上で下記ハンズオン
• GitOps
• Prometheus
• Alerting
17
デモ
• WeaveCloud + GKE + Github
18
Production Readyチェックリスト
19
アプリケーションチェックリスト
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/k8s-production-checklist”
20
クラスタチェックリスト
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/k8s-production-checklist”
21
モニタリング
22
メトリクス
何を測れば︖
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/monitoring-with-prometheus”
23
良いアラート
アラートに対応手順へのリンクも含める
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/hands-on-prometheus”
24
Deployment
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/k8s-advanced-deployments”
25
Blue/Green + Dark Traffic Deployment Strategy
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/k8s-advanced-deployments”
実トラフィックをミラーして新バージョンにも流す
26
クラスタの管理
27
Enterprise Architecture Patterns
Control Clusterで各Tenant Clusterをデプロイ、管理
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/kubernetes-enterprise-patterns”
28
gitopsでcluster管理
エンタープライズな要求 + クラスタの増加 = yaml explosion
ハンズオンではやらなかったがFluxでできるとのこと
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/kubernetes-enterprise-patterns”
29
Enterprise Architecture Patterns
濃い緑がControl Cluster
薄い緑がTenant
青がTenant Cluster
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/kubernetes-enterprise-patterns”
30
Control and Tenant
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/kubernetes-enterprise-patterns”
31
Hub and spoke
社内で提供してもらっているk8sはこれ
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/kubernetes-enterprise-patterns”
32
Self Service
担当プロダクトの⼀部がこれ
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/kubernetes-enterprise-patterns”
33
セキュリティ
“Created by Weaveworks / Derived from material created by Weaveworks.
Original available at https://tinyurl.com/k8s-security-intro”
34
まとめ
• Weave Cloud + GKE を使ったハンズオンで簡単にGitopsを体験
• 興味がある⽅はトライアルアカウント使って簡単に動かせます
• 公開されてる資料を活⽤してProduction Readyに
• アプリケーション側で考慮すべきこと
• クラスタ側で考慮すべきこと
• Deployment Strategy
• GitopsとFluxを活⽤してクラスタ⾃体も管理できる
• ガバナンスを考慮してクラスタを構成
• App, Control plane, Gitそれぞれでセキュリティを考慮
35
当日の資料リンク
• Workshop全体: https://tinyurl.com/kubecon-2019-workshop
• Prometheusとmonitoring, observability: https://tinyurl.com/monitoring-with-prometheus
• Prometheus hands-on: https://tinyurl.com/hands-on-prometheus
• The Production Ready Checklist: https://tinyurl.com/k8s-production-checklist
• GitOps introduction: https://tinyurl.com/introduction-to-gitops
• GitOps in practice: https://tinyurl.com/gitops-in-practice
• k8s deployments: https://tinyurl.com/k8s-advanced-deployments
• Enterprise Pattern: https://tinyurl.com/kubernetes-enterprise-patterns
• Security Intro: https://tinyurl.com/k8s-security-intro
“Created by Weaveworks / Derived from material create by Weaveworks.
Original available at https://tinyurl.com/kubecon-2019-workshop”
Kubecon NA 2019 Recap: Your Path to Production Ready Kubernetes hosted by Weaveworks

Kubecon NA 2019 Recap: Your Path to Production Ready Kubernetes hosted by Weaveworks