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
Ian Lewis
March 08, 2018
Technology
12
17k
Kubernetesのセキュリティのベストプラクティス
Ian Lewis
March 08, 2018
Tweet
Share
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.3k
The Enemy Within: Running untrusted code with gVisor
ianlewis
4
1.1k
KubeCon EU Runtime Track Recap
ianlewis
3
1.6k
コンテナによるNoOpsオートメーション
ianlewis
2
150
Google Kubernetes Engine 概要 & アップデート @ GCPUG Kansai Summit Day 2018
ianlewis
2
900
Extending Kubernetes with Custom Resources and Operator Frameworks
ianlewis
10
3.7k
Scheduling and Resource Management in Kubernetes
ianlewis
2
1.4k
Keynote: The Kubernetes Community
ianlewis
0
220
Other Decks in Technology
See All in Technology
EMConf JP 2025 懇親会LT / EMConf JP 2025 social gathering
sugamasao
2
200
Perlの生きのこり - エンジニアがこの先生きのこるためのカンファレンス2025
kfly8
2
270
"TEAM"を導入したら最高のエンジニア"Team"を実現できた / Deploying "TEAM" and Building the Best Engineering "Team"
yuj1osm
1
200
NFV基盤のOpenStack更新 ~9世代バージョンアップへの挑戦~
vtj
0
360
AWSではじめる Web APIテスト実践ガイド / A practical guide to testing Web APIs on AWS
yokawasa
8
720
AI Agent時代なのでAWSのLLMs.txtが欲しい!
watany
2
230
php-conference-nagoya-2025
fuwasegu
0
150
ESXi で仮想化した ARM 環境で LLM を動作させてみるぞ
unnowataru
0
180
Visualize, Visualize, Visualize and rclone
tomoaki0705
9
83k
AI自体のOps 〜LLMアプリの運用、AWSサービスとOSSの使い分け〜
minorun365
PRO
3
170
ExaDB-XSで利用されているExadata Exascaleについて
oracle4engineer
PRO
3
260
Fraxinus00tw assembly manual
fukumay
0
110
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Into the Great Unknown - MozCon
thekraken
35
1.6k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.3k
Mobile First: as difficult as doing things right
swwweet
223
9.4k
The Cost Of JavaScript in 2023
addyosmani
47
7.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Building Your Own Lightsaber
phodgson
104
6.2k
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!