Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kubernetesのセキュリティのベストプラクティス
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ian Lewis
March 08, 2018
Technology
17k
12
Share
Kubernetesのセキュリティのベストプラクティス
Ian Lewis
March 08, 2018
More Decks by Ian Lewis
See All by Ian Lewis
Kubernetes Security Best Practices
ianlewis
38
26k
The Enemy Within: Running untrusted code in Kubernetes
ianlewis
0
1.4k
The Enemy Within: Running untrusted code with gVisor
ianlewis
4
1.3k
KubeCon EU Runtime Track Recap
ianlewis
3
1.7k
コンテナによるNoOpsオートメーション
ianlewis
2
200
Google Kubernetes Engine 概要 & アップデート @ GCPUG Kansai Summit Day 2018
ianlewis
2
980
Extending Kubernetes with Custom Resources and Operator Frameworks
ianlewis
10
3.9k
Scheduling and Resource Management in Kubernetes
ianlewis
2
1.5k
Keynote: The Kubernetes Community
ianlewis
0
270
Other Decks in Technology
See All in Technology
巨大プラットフォームを進化させる「第3のROI」
recruitengineers
PRO
2
2.4k
Fabric MCPの紹介と使い分け
ryomaru0825
1
130
【技術書典20】OpenFOAM(自宅で深める流体解析)流れと熱移動(2)
kamakiri1225
0
370
AIと乗り切った1,500ページ超のヘルプサイト基盤刷新とさらにその先の話
mugi_uno
2
310
Databricks Academic Series 〜 大規模言語モデル / エージェント編 〜 / academic-series-llm
databricksjapan
0
110
Google Cloud Next '26 の裏でこっそりリリースされたCloud Number Registry & Cloud Hub コスト分析 を試してみた
hikaru1001
0
160
CyberAgent YJC Connect
shimaf4979
1
160
カオナビに Suspenseを導入するまで / The Road to Suspense at kaonavi
kaonavi
1
430
雑談は、センサーだった
bitkey
PRO
2
200
Building Production-Ready Agents Microsoft Agent Framework
_mertmetin
0
160
Oracle Exadata Database Service on Cloud@Customer X11M (ExaDB-C@C) サービス概要
oracle4engineer
PRO
2
7.9k
インターネットのガバナンスと応用 / Internet Governance and Applications
ks91
PRO
0
120
Featured
See All Featured
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
500
GraphQLとの向き合い方2022年版
quramy
50
15k
How STYLIGHT went responsive
nonsquared
100
6.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
370
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Navigating Team Friction
lara
192
16k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Transcript
Kubernetesのセキュリティ ベストプラクティス ianmlewis@
Ian Lewis • ianlewis@ • Google • Tokyo, Japan •
#kubernetes, #go, #python
Kubernetes • コンテナ オーケストレーション • インフラ API/ フレームワーク
Guestbookアプリ • Web Frontend ◦ ウェブアプリ ◦ HTML/JS/CSS • Message
◦ メッセージを 保存・閲覧 • NGWord ◦ NG ワードを 検出する Kubernetes Cluster Web Frontend Redis NGWord message
Kubernetes API Server 1. フロントエンド Pod から トークンを取得 2. トークンを利用し、
API サーバーを攻撃 3. シークレットなどを取得 し、さらに サービスを攻撃 Kubernetes Cluster Web Frontend Redis NGWord message ① ② ③
Mitigate 1 & 2: RBAC • Role Based Access Control
• ユーザーやサービスアカウントへロールを付与 • ロールが権限を持つ ◦ get secrets ◦ update configmap ◦ etc. • RBAC 設定はネームスプペース範囲 • GKE では IAM と連携
Mitigate 1 & 2: RBAC ClusterRole ClusterRoleBinding 1:many many:1 Verb
+ Type
Mitigate 2: API Server Firewall • API サーバーへのアクセスを IP アドレスに制限
• GKE: ◦ gcloud container clusters create --enable-master-authorized-networks --master-authorized-networks=....
Mitigate 3: Network Policy • データベースへのアクセスを必要のある Pod に制限 • ラブルセレクターで
Pod を選択 • ネットワークプラグインで実装されてる : Calico, Weave, etc.
NetworkPolicy kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: name: redis spec: podSelector:
matchLabels: name: redis ingress: - from: - podSelector: matchLabels: name: guestbook
ホストへアクセス 1. コンテナ外へ突破 2. Kubelet を攻撃 3. 同じホストに実行中の コンテナを攻撃 Host
Web Frontend
Mitigate 1: non-rootユーザーで実行 apiVersion: v1 kind: Pod metadata: name: security-context-demo
spec: securityContext: runAsUser: 1000
Mitigate 1: 読込専用ファイルシステム apiVersion: v1 kind: Pod metadata: name: security-context-demo
spec: securityContext: readOnlyRootFilesystem: true
Mitigate 1: no_new_privs apiVersion: v1 kind: Pod metadata: name: security-context-demo
spec: securityContext: allowPrivilegeEscalation: false
Mitigate 1: 組み合わせ apiVersion: v1 kind: Pod metadata: name: security-context-demo
spec: securityContext: runAsUser: 1000 readOnlyRootFilesystem: true allowPrivilegeEscalation: false
Your App Container seccomp Mitigate 1: seccomp/ AppArmor/ SELinux AppArmor/
SELinux
seccomp apiVersion: v1 kind: Pod metadata: name: mypod annotations: seccomp.security.alpha.kubernetes.io/pod:
runtime/default ...
AppArmor apiVersion: v1 kind: Pod metadata: name: mypod annotations: container.apparmor.security.beta.kubernetes.io/hello:
runtime/default spec: containers: - name: hello ...
SELinux apiVersion: v1 kind: Pod metadata: name: mypod spec: securityContext:
seLinuxOptions: level: "s0:c123,c456" containers: - name: hello ...
Mitigate 2 & 3: Kubeletの権限を制限する • RBAC for Kubelet: ◦
--authorization-mode=RBAC,Node --admission-control=...,NodeRestriction • Rotate Kubelet certs: ◦ kubelet … --rotate-certificates
Unsecured Pods • You follow the rules but others don't
Kubernetes Cluster Web Frontend Redis NGWord message
Mitigate: PodSecurityPolicy apiVersion: extensions/v1beta1 kind: PodSecurityPolicy metadata: name: example spec:
privileged: false # Don't allow privileged pods! # The rest fills in some required fields. seLinux: rule: RunAsAny supplementalGroups: rule: RunAsAny runAsUser: rule: 1000 fsGroup: rule: RunAsAny volumes: - '*'
istio • Service mesh • Envoy proxy 組み込み
トラフィクを傍受 1. ネットーワーク上の通 信を傍受 2. あるサビースに不正リ クエストを送る Kubernetes Cluster Web
Frontend Redis NGWord message
istio 1. サービス間の プロクシー 2. 暗号化 3. 証明書の自動更新 4. ポリシーが
セントラルサーバで集 中して管理する Kubernetes Cluster Web Frontend Redis NGWord message
Thanks!