Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
GKE@AbemaTV
Search
Ryosuke Suto
October 15, 2016
Technology
9.8k
12
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GKE@AbemaTV
AbemaTV Developer Conference 2016
Ryosuke Suto
October 15, 2016
More Decks by Ryosuke Suto
See All by Ryosuke Suto
横断的なSRE推進と成熟度評価
strsk8
9
8.8k
GKEを利用したサービスの運用
strsk8
1
720
パブリック/プライベートクラウドでつかうKubernetes
strsk8
1
2.5k
re:Invent2015参加レポ
strsk8
0
350
成長し続けるインフラの安定運用事情
strsk8
19
5.3k
ソーシャルゲームDBの危機回避
strsk8
10
15k
Other Decks in Technology
See All in Technology
データ界隈LT祭 第1回LT登壇
taromatsui_cccmkhd
1
1.3k
積み重なった技術負債への挑戦 〜初手としての全社ゴト化〜
techtekt
PRO
0
1.2k
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
810
2026/09/10 Spring Bootから Jakarta EE/MicroProfileへの移行
megascus
0
370
Reactの設計論
uhyo
24
13k
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
130
HHKBエバンジェリストになる方法
941
0
100
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
480
GoにおけるFFIのこれまでとこれから
goccy
5
3.4k
ソフトウェアDNAとクラウドエージェントのススメ
cloudace
0
110
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
1
520
Issue 駆動でスペシャリストの意図を届ける、AI 実装のアクセシビリティ向上
thkt
0
110
Featured
See All Featured
Building Adaptive Systems
keathley
44
3.2k
KATA
mclloyd
PRO
35
15k
Producing Creativity
orderedlist
PRO
348
41k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
540
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
So, you think you're a good person
axbom
PRO
2
2.2k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Abbi's Birthday
coloredviolet
4
10k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.9k
Mind Mapping
helmedeiros
1
360
Transcript
GKE@AbemaTV Ryosuke Suto 2016/10/15 AbemaTV Developer Conference 2016
@strsk • 須藤涼介(Ryosuke SUTO) • (株)サイバーエージェント • 技術本部 • サービスリライアビリティグループ
Agenda • GKE is... • 選んだ理由 • 設計の話 • 運用、あれこれ
GKE is...
GKEとは • Google Container Engine • Kubernetesのフルマネージドサービス • 略すとGCEとかぶるため、KubernetesのK をとってGKE
Kubernetes くーばねいてぃす
Kubernetes(k8s)とは • Dockerのオーケストレーションツール • コンテナのグルーピングやネットワーク、 監視などをマニフェストファイル(YAML)で 管理する
Node1 Minion1 RC1 Pod1-1 Pod1-2 Pod2-1 Pod2-2 Service1 Service2 Kubernetesの構成
• Master:クラスタを管理 ◦ GKEでは表示されない • Minion:コンテナが起動するノード • Pod:コンテナのグループ • Replication Controller:起動するPod数や 環境変数を管理(Deployments) • Service:Pod郡のエンドポイント
GKE@AbemaTV
iOS GCP Load Balancing Cloud DNS Cloud Storage Compute Engine
Redis Compute Engine MongoDB Stackdriver Monitoring Pub/Sub BigQuery Stackdriver Logging 画像基盤 広告基盤 Client Backend Monitor CDN API/web Container Engine(GKE) Gateway Media Proxy コメント ユーザー 課金 web etc Logging Compute Engine transcoder 社内基盤 ログ基盤 スタジオ/ロケ地 Studio transcoder ここの話
アーキテクチャ • GKE • GCE • GCS • Stackdriver •
BigQuery • Cloud Pub/Sub • Redis, MongoDB • Varnish, Nginx
選んだ理由 ワ ケ
GKE(k8s)を選んだ理由 • GKEがGAに(2015年8月) • k8sのフルマネージドサービス • 活発な開発、アップデート • microservicesとの親和性
設計の話
SPEC • n1-highcpu-16 × 50node ◦ 16 vCPUs, 14.4 GB
memory • 33 Services • 216 Pods
SPEC • default requests & limits ◦ cpu: 4000m ◦
memory: 3Gi
RequestsとLimits • Requests ◦ Pod起動時に必要なリソース • Limits ◦ Podのリソース制限
RequestsとLimits • RequestsとLimitsに開きがあると高負荷 時にMinionのリソースが枯渇する • Podスケール時にスケジュールしていた Limitsを超える可能性がある
RequestsとLimits • kubectl describe node [node]でリソース 全体の何%まで割り当てられているか確 認できる
1(cluster)×N(services) • 追加機能でインフラの準備不要◯ • 運用コストの低減◯ • 各service同士はlocalhostで接続◯
1(cluster)×N(services) • リソース消費の見極めが複雑化△ • レプリカ数が少ないPodは、タイミングに よって同じノードに起動してしまうことが ある△
Docker Image • 基本はAlpine Linux ◦ Docker向きの超軽量OS • デプロイの頻度が少ない、提供されていないパッ ケージがある場合はUbuntu
リリースフロー
Container Registry Container Cluster docker push deploy docker push push
test Docker Hub
kubectl • リソースの作成 kubectl create -f xxx.yml • 設定内容の更新 kubectl
apply -f xxx.yml
kubectl • Rolling-Update kubectl rolling-update xxx -f xxx.yml • Podのスケールアウト
kubectl scale rc xxx --replicas=10
kubectl rolling-updateの課題 • v1.2.0以降、同じタグ指定で Rolling-Updateができない • 途中で失敗するとSelectorが中途半端 な状態で残ってしまう
kubetool
kubetool https://github.com/abema/kubetool • kubectlをラップした補助ツール • 一覧表示の改善 • カナリアリリース
kubetool • Podの一覧 kubetool pods • ReplicationControllerの一覧 kubetool rc
kubetool • Podの再作成 kubetool reload [rc] • RCのイメージ更新 kubetool update
[rc] [version]
kubetool • Podを1台だけ再作成 kubetool reload [rc] --1 • 残りのPodも最新にする kubetool
fix-version [rc]
監視
Stackdriver Monitoring/Logging • 標準で取れるのはリソース状況のみ • Podの標準出力はLoggingへ • 強力なフィルター機能 • ログベースメトリクスの作成が可能
kube-ui • 各コンポーネントの情報一覧 • Podの消費リソース • スケール • YAMLファイルの編集
運用、あれこれ
Terraformとの別離 • TerraformでInstance Templateを編集するとインスタ ンスが全台再作成される • 無停止でスケールアップ/ダウンする場合はテンプ レートを手動で付け替える必要がある • コード化…
ServiceのIPに接続できない • HTTP Load Balancerからは繋がる • LAN内のインスタンスやPodから接続で きない • v1.2.0でのバグ
Nodeアップグレード時に断発生 • 1台ずつアップグレードされるが、Podが 先に落ちないため数秒団が発生 • Node Pool機能で段階的にアップグレー ドする方法が良い
まとめ
GKEをつかってみた感想 • Docker導入の敷居が低くなる • デプロイ簡単 • リソース調整にはコツがいる • DevOpsが捗る
May the Docker be with you.