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
Admission Webhookで快適なSecret管理 / Berglas Secret ...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
go_vargo
December 18, 2019
Programming
3.8k
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Admission Webhookで快適なSecret管理 / Berglas Secret Admission Webhook
go_vargo
December 18, 2019
More Decks by go_vargo
See All by go_vargo
Kubernetes Internal #9 - Minikube
govargo
0
360
気をつけたいKubernetesとの付き合い方 / Happy Kubernetes Life
govargo
6
3k
[CNDT2020]Linux Observability with BPF Performance Tools
govargo
15
3.7k
[CNDK2019]Production Ready Kubernetesに必要な15のこと / Production Ready Kubernetes 15 Rules
govargo
38
16k
ゼロから始めるKubernetes Controller / Under the Kubernetes Controller
govargo
40
16k
Inside of Kubernetes Controller
govargo
20
12k
コロプラが実践しているSpinnakerを用いたデプロイ戦略 / Deploy Strategy with Spinnaker at Colopl
govargo
6
5.1k
Improve Docker Image by BuildKit
govargo
4
1.7k
Debugging for MicroService on Kubernetes
govargo
2
820
Other Decks in Programming
See All in Programming
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
210
Go 1.27 における memory allocation の高速化
andpad
0
170
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
490
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
270
仕様駆動開発の消費期限
watany
20
8.2k
Laravel Boostに学ぶ、AIにPHPを書かせる技術 〜OSSの実装から蒸留するエージェント制御の王道〜
kentaroutakeda
3
690
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.8k
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
360
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
18k
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
500
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
560
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Docker and Python
trallard
47
4.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Utilizing Notion as your number one productivity tool
mfonobong
4
540
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
390
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
200
GitHub's CSS Performance
jonrohan
1033
470k
How to build a perfect <img>
jonoalderson
1
5.9k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
64
56k
Paper Plane
katiecoart
PRO
2
53k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
200
First, design no harm
axbom
PRO
2
1.2k
Transcript
Admission Webhook ͰշదͳSecretཧ 2019/12/18 Kubernetes Invitational Meetup Tokyo #4
Admission Webhookͱʁ
Admission Control Admission ControlೝূɾೝՄͷޙʹɺAPI RequestΛ มߋ(Mutate)ɾݕূ(Validate)Ͱ͖ΔΈ )551 )BOEMFS "VUIFOUJDBUF "VUIPSJ[F
.VUBUF "ENJTTJPO 4DIFNF 7BMJEBUJPO 7BMJEBUF "ENJTTJPO ɾɾɾ
Admission Control Admission ControlೝূɾೝՄͷޙʹɺAPI RequestΛ มߋ(Mutate)ɾݕূ(Validate)Ͱ͖ΔΈ )551 )BOEMFS "VUIFOUJDBUF "VUIPSJ[F
.VUBUF "ENJTTJPO 4DIFNF 7BMJEBUJPO 7BMJEBUF "ENJTTJPO ɾɾɾ
LVCFBQJTFSWFS 3FTPVSDF)BOEMFS .VUBUJOH 8FCIPPL 7BMJEBUJOH 8FCIPPL "ENJTTJPO8FCIPPL ʜ ʜ ʜ
ʜ "ENJTTJPO ʜ ʜ 7BMJEBUJPO Admission Webhook ҙͷॲཧΛWebServer ͷHookͱͯ͠ՃͰ͖Δ
ࠓճ࡞ͬͨAdmission Webhook
Berglas Secret Admission Webhook GCPͷSecretཧπʔϧͰ͋Δ BerglasΛͬͯɺಁաతͳSecretཧΛ࣮ݱ
࡞ͬͨAdmission Webhookͷత త: SecretͷཧͰɺGit্ʹSecretͷValueΛ͞ͳ͍ Α͏ʹ͍ͨ͠ɻGCP্ͷSecretཧʹBerglasΛ ͍ͬͯΔͷͰɺBerglasΛK8sͰ׆༻͍ͨ͠ɻ apiVersion: v1 kind: Secret
metadata: name: database_secret data: PASS: cGFzc3dvcmQ= $ echo cGFzc3dvcmQ= | base64 --decode password : ͨͩͷBase64Τϯίʔυͩͱ ͙͢ʹσίʔυͰ͖ͯ͠·͏ ࡞ͬͨAdmission Webhook: Berglas্ʹ࡞ͬͨSecretΛɺK8s্ʹ෮߸ͯ͘͠ΕΔ → YAML୭͕ݟͯͳ͍Α͏ʹ͢Δ
Berglas BerglasGoogle Cloud Platform্ͰSecret(ൿີใ)Λ ཧ͢ΔͨΊͷCLIπʔϧɻ Cloud KMSʹ͋Δ伴ΛͬͯɺBerlgasͰSecretΛ҉߸ Խɾ෮߸ԽͰ͖Δ (※K8s SecretͱผͳͷͰҙ)
Key Management Service Cloud Storage #FSHMBT ҉߸ʹར༻ Secretσʔλ͕࡞ΒΕΔ berglas create <BUCKET>/<KEY> <VALUE> Encrypt
Berglas BerglasGoogle Cloud Platform্ͰSecret(ൿີใ)Λ ཧ͢ΔͨΊͷCLIπʔϧɻ Cloud KMSʹ͋Δ伴ΛͬͯɺBerlgasͰSecretΛ҉߸ Խɾ෮߸ԽͰ͖Δ (※K8s SecretͱผͳͷͰҙ)
Key Management Service Cloud Storage #FSHMBT ෮߸ʹར༻ SecretσʔλΛࢀর berglas access <BUCKET>/<KEY> Decrypt
Admission Webhook࡞ʹͬͨͷ Kubewebhook: Admission WebhookΛ࡞ΔͨΊͷϑϨʔϜϫʔΫ AdmissionReview, AdmissionResponseͱ͍ͬͨɺ Admission Webhookʹඞཁͳ෦Λड͚࣋ͬͯ͘ΕΔ ར༻ऀMutateؔͱValidateؔͷ࣮ʹूதͰ͖Δ
Berglas API: https://github.com/slok/kubewebhook https://github.com/GoogleCloudPlatform/berglas SampleͰCloud FunctionΛར༻ͨ͠Admission Webhookͷ ྫ͋Δ͕ɺ༻్͕ҟͳͬͨͷͰࠓճWebhookΛࣗ࡞ https://github.com/GoogleCloudPlatform/berglas/tree/master/examples/kubernetes
Berglas Secret Admission Webhook SecretΛ࡞͢Δͱɺʮberglas://ʙʯͱ͍͏ϦϑΝϨϯε ͕͋Δͷɺಁաతʹ෮߸Խ͢Δ(ͦΕҎ֎εΩοϓ) ᶃ kubectl apply -f
secret.yaml Mutating Webhook Server Validating Webhook Server #FSHMBT apiVersion: v1 kind: Secret metadata: name: database_secret data: PASS: berglas://BUCKET/pass ᶄ Admission Webhook ᶅ Mutate ᶇ Validate ᶆ Decode
ϋϚͬͨͱ͜Ζ
Managed K8sͰಈ͔ͳ͍(ͱצҧ͍ͯͨ͠) Admission Webhook cannot work on private GKE clusters
https://github.com/elastic/cloud-on-k8s/issues/1437 443ϙʔτҎ֎ͰɺWebhook ServerΛಈ͔͍ͯ͠Δͱɺ Webhook ServerͷPod·ͰAPI Request͕౸ୡ͠ͳ͍ɻ GKEͰΤϯυϙΠϯτIPʹ௨৴͢Δ͕ɺ443(HTTPS), 10250(Kubelet)ͷϙʔτ͔͠ڐՄ͞Ε͍ͯͳ͍ͨΊ Webhook Server Master VPC Worker VPC Port: 443 ڐՄ ※443Ҏ֎ͷ߹ɺϑΝΠΞΥʔϧͷ݀։͚͕ඞཁ
ࢀߟʹ͢Δͱྑ͍ͷ Admission Webhooks: Configuration and Debugging Best Practices - Haowei
Cai, Google https://kccncna19.sched.com/event/UaVt/admission-webhooks-configuration-and-debugging-best- practices-haowei-cai-google
Thank you