Private Azure Kubernetes
Service cluster
を触ってみよう♪
第26回 Tokyo Jazug Night
https://jazug.connpass.com/event/165186/
#jazug
アジェンダと注意点
注意点
 記載している情報は 2020/03/25 の時点の情報です
話すこと
 Private Azure Kubernetes Service cluster について
 個人的に注目している新機能について
話さないこと
 Azure についての詳細説明
 Kubernetes についての詳細説明
 Azure Kubernetes Service (AKS) についての詳細説明 3
注意事項
この発表は個人の意見であり、
所属する会社及び団体を
代表する発言ではございません
4
Self introduction
Hello ;)
自己紹介
person:
name: "Toru Igarashi"
twitter: "@iganari_"
github: "@iganari"
position:
company: "Cloud Ace Inc."
role: "SRE"
skills: [ Terraform, Ansible, Kubernetes ]
blood-donation:
count: 111
description: "I can donate blood a little"
6
Security in Your AKS
あなたの AKS のセキュリティは
本当に大丈夫ですか?
AKS を運用していてこんなこと言われませんか??
クラスタへ接続出来る拠点を制限しなさい
 ex) [情シス] > 事務所からの接続のみにしてください(^^
Pod と外部インターネットとの通信を監視・制御しなさい
 ex) [設計者] > 特定の外部 API だけアクセス可能にしてください(^^
8
AKS を運用していてこんなこと言われませんか??
クラスタへ接続出来る拠点を制限しなさい
 ex) [情シス] > 事務所からの接続のみにしてください(^^
Pod と外部インターネットとの通信を監視・制御しなさい
 ex) [設計者] > 特定の外部 API だけアクセス可能にしてください(^^
9
(本当に解決すべき問題か否かはさておき)
セキュリティの問題は
未だに山積している
ベスプラから学ぶ AKS
公式ドキュメント
 https://docs.microsoft.com/en-us/azure/aks/best-practices
 AKS 製品グループ、エンジニアリングチーム、およびグローバルブラックベルト (GBB)
を含むフィールドチームと連携して作成されたベストプラクティス
 Multi-tenancy, Security, Network and storage, Running enterprise-ready workloads
と分野に分かれて纏まっています
 AKS に携わるエンジニアは必読です!!
10
What is
Private AKS cluster ?
Private AKS cluster とは
Private AKS cluster とは
説明
 AKS の Control Plane 及び、Node pools が RFC 1918 で定義されている内部 IP ア
ドレスのみが割り当てられている cluster を作ることが出来ます
 (Control Plane に内包されている) API サーバーとNode pool (内の Node) 間のネ
ットワークトラフィックがプライベートネットワークのみに留まるようにす
ることが出来ます
12ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
Private AKS cluster とは
説明
 AKS の Control Plane 及び、Node pools が RFC 1918 で定義されている内部 IP ア
ドレスのみが割り当てられている cluster を作ることが出来ます
 (Control Plane に内包されている) API サーバーとNode pool (内の Node) 間のネ
ットワークトラフィックがプライベートネットワークのみに留まるようにす
ることが出来ます
な、なるほど分からん...(・w・;;)
13ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
Private AKS cluster とは
Azure Power Lunch: Private Azure Kubernetes Service cluster
14
Create
Private AKS cluster
Private AKS cluster を作ってみよう
Private AKS cluster 作成コマンド
### Resource Group 作成
az group create --location japaneast 
--name ${private-cluster-resource-group}
### AKS cluster 作成
az aks create --name ${private-cluster-name} 
--resource-group ${private-cluster-resource-group} 
--load-balancer-sku standard 
--enable-private-cluster
16Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
Private AKS cluster 作成コマンド
### Resource Group 作成
az group create --location japaneast 
--name ${private-cluster-resource-group}
### AKS cluster 作成
az aks create --name ${private-cluster-name} 
--resource-group ${private-cluster-resource-group} 
--load-balancer-sku standard 
--enable-private-cluster
17Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
※ 2020/03/24 時点での話
Private AKS cluster 作成コマンド
18
GitHub に Bug として Issue 化され済み
https://github.com/Azure/azure-cli/issues/9585
一度解決して Merge されたが未だ解決してない模様
(Azure CLI version 2.2.0)
しかし、暫定的な解決方法は報告されています!!
素敵ですね!! :)
Private AKS cluster 作成コマンド (修正版)
### Resource Group 作成
az group create --location japaneast --name ${private-cluster-resource-group}
### Service Principal の作成
az ad sp create-for-rbac --name ${service-principal-name}
--> appId, password をメモしておく
### AKS cluster 作成
az aks create --name ${private-cluster-name} 
--resource-group ${private-cluster-resource-group} 
--load-balancer-sku standard 
--enable-private-cluster 
--service-principal ${service-principal-appid} 
--client-secret ${service-principal-password}
19Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
修正点
• Service Principal (SP)の作成
• az aks create 時に SP 指定
Private AKS cluster を Azure portal から確認
20
Node pools が所属する Resource Group の比較
Private AKS cluster の node pools の
Resource Group
通常の AKS cluster の node pools の
Resource Group
21
Node pools が所属する Resource Group の比較
Private AKS cluster の node pools の
Resource Group
通常の AKS cluster の node pools の
Resource Group
22
Private DNS zone
Private endpoint
Network interface
が増えている
Check Point of
Private AKS cluster
Private AKS cluster の注意点
Private AKS cluster の注意点 1/3
cluster への接続の問題
Azure managed control plane に Public IP Address が無いので
Private AKS cluster へのネットワーク接続を確立しなければいけない
 ‘az login’ && ‘az aks get-credentials’ だけでは接続出来ない
Private AKS cluster に接続する方法
 AKS cluster と同じAzure Virtual Network (VNet) 内に VM を作成する
 別の Network 内 で VMを作成し、 Virtual network peering を設定する
 Express Route or VPN を接続を使う
24Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
Private AKS cluster の注意点 2/3
構築出来るリージョンに制限がある
今回の GA によって、リージョンの制限が無くなりました!!
 日本語 doc の修正が追いついていないので、今なら Preview 時のドキュメントが見れます
 https://docs.microsoft.com/ja-jp/azure/aks/private-clusters
25Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
Private AKS cluster の注意点 3/3
依存関係や制限事項などがあります
詳しくは公式ドキュメントを確認しましょう
依存関係 (Dependencies)
 https://docs.microsoft.com/en-us/azure/aks/private-clusters#dependencies
制限事項 (Limitations)
 https://docs.microsoft.com/en-us/azure/aks/private-clusters#limitations
26Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
余談
実は GCP にも似たような cluster があります…
Private clusters (限定公開クラスタ)
 https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept
 2018/10/2 に GA
 https://cloud.google.com/kubernetes-engine/docs/release-notes#october-2-2018
27
余談
実は GCP にも似たような cluster があります…
Private clusters (限定公開クラスタ)
 https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept
 2018/10/2 に GA
 https://cloud.google.com/kubernetes-engine/docs/release-notes#october-2-2018
28
今回の GA により、
やっと追いついた感!!(?)
New Feature
個人的に注目している新機能をご紹介
個人的に注目している新機能 (2020/03/24 の時点 で Preview)
Spot Node Pool を AKS cluster にて使う機能
 Add a spot node pool to an AKS cluster
 https://docs.microsoft.com/en-us/azure/aks/spot-node-pool
 Spot VM を用いた Virtual Machine Scale Sets を AKS の Node pool として使用する
ことが出来る機能です
 コスト削減に大きな期待が出来ます
 Spot VMs 等については次ページ参照
30
個人的に注目している新機能 (2020/03/24 の時点 で Preview)
Spot VMs について
 Use Spot VMs in Azure
 https://docs.microsoft.com/en-us/azure/virtual-machines/windows/spot-vms
Virtual Machine Scale Sets で Spot VMs を 使う機能
 Azure Spot VMs for virtual machine scale sets
 https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/use-spot
31
まとめ
Private AKS cluster が GA になりました!!
 主にセキュリティ要件において、効果を発揮する(はず)でしょう
 依存関係や制限事項があるので、うまく使いこなしましょう
 仮にバグがあっても、コミュニティの力で解決する可能性があります
新機能もどんどん出ているので積極的に試しましょう!!
 Azure Spot VMs for virtual machine scale sets 等
32
Enjoy AKS !! ;)
♬
♬
♪
♪
♪
♬
34
資料: 画像系
GitHub: jazug.jp
 https://github.com/jazug/jazug.jp/
Azure Icons
 https://azure.microsoft.com/en-us/patterns/styles/glyphs-icons/
壁紙作成者様
 横井 羽衣子 さん
 https://www.facebook.com/uikou
35
資料: 公式ドキュメント
Azure Kubernetes Service (AKS)
 https://azure.microsoft.com/en-us/services/kubernetes-service/
Create a private Azure Kubernetes Service cluster
 https://docs.microsoft.com/en-us/azure/aks/private-clusters
Kubernetes core concepts for AKS
 https://docs.microsoft.com/en-us/azure/aks/concepts-clusters-workloads
Security concepts for applications and clusters in AKS
 https://docs.microsoft.com/en-us/azure/aks/concepts-security
YouTube: Private Azure Kubernetes Service cluster
 https://www.youtube.com/watch?v=rgj2nSXkzak
36
資料: 公式ドキュメント (2020/03/24 の時点 で Preview)
Add a spot node pool to an Azure Kubernetes Service (AKS) cluster
 https://docs.microsoft.com/en-us/azure/aks/spot-node-pool
Use Spot VMs in Azure
 https://docs.microsoft.com/en-us/azure/virtual-machines/windows/spot-vms
Deploy Spot VMs using the Azure portal
 https://docs.microsoft.com/en-us/azure/virtual-machines/windows/spot-portal
Azure Spot VMs for virtual machine scale sets
 https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/use-spot
37
資料: ドキュメント
Azure Kubernetes (AKS) Security Best Practices Part 1 of 4
 https://www.stackrox.com/post/2020/01/azure-kubernetes-aks-security-best-
practices-part-1-of-4/
38
資料: Kubernetes Components
39ref: https://kubernetes.io/docs/concepts/overview/components/

Private Azure Kubernetes Service cluster を触ってみよう♪

  • 2.
    Private Azure Kubernetes Servicecluster を触ってみよう♪ 第26回 Tokyo Jazug Night https://jazug.connpass.com/event/165186/ #jazug
  • 3.
    アジェンダと注意点 注意点  記載している情報は 2020/03/25の時点の情報です 話すこと  Private Azure Kubernetes Service cluster について  個人的に注目している新機能について 話さないこと  Azure についての詳細説明  Kubernetes についての詳細説明  Azure Kubernetes Service (AKS) についての詳細説明 3
  • 4.
  • 5.
  • 6.
    自己紹介 person: name: "Toru Igarashi" twitter:"@iganari_" github: "@iganari" position: company: "Cloud Ace Inc." role: "SRE" skills: [ Terraform, Ansible, Kubernetes ] blood-donation: count: 111 description: "I can donate blood a little" 6
  • 7.
    Security in YourAKS あなたの AKS のセキュリティは 本当に大丈夫ですか?
  • 8.
    AKS を運用していてこんなこと言われませんか?? クラスタへ接続出来る拠点を制限しなさい  ex)[情シス] > 事務所からの接続のみにしてください(^^ Pod と外部インターネットとの通信を監視・制御しなさい  ex) [設計者] > 特定の外部 API だけアクセス可能にしてください(^^ 8
  • 9.
    AKS を運用していてこんなこと言われませんか?? クラスタへ接続出来る拠点を制限しなさい  ex)[情シス] > 事務所からの接続のみにしてください(^^ Pod と外部インターネットとの通信を監視・制御しなさい  ex) [設計者] > 特定の外部 API だけアクセス可能にしてください(^^ 9 (本当に解決すべき問題か否かはさておき) セキュリティの問題は 未だに山積している
  • 10.
    ベスプラから学ぶ AKS 公式ドキュメント  https://docs.microsoft.com/en-us/azure/aks/best-practices AKS 製品グループ、エンジニアリングチーム、およびグローバルブラックベルト (GBB) を含むフィールドチームと連携して作成されたベストプラクティス  Multi-tenancy, Security, Network and storage, Running enterprise-ready workloads と分野に分かれて纏まっています  AKS に携わるエンジニアは必読です!! 10
  • 11.
    What is Private AKScluster ? Private AKS cluster とは
  • 12.
    Private AKS clusterとは 説明  AKS の Control Plane 及び、Node pools が RFC 1918 で定義されている内部 IP ア ドレスのみが割り当てられている cluster を作ることが出来ます  (Control Plane に内包されている) API サーバーとNode pool (内の Node) 間のネ ットワークトラフィックがプライベートネットワークのみに留まるようにす ることが出来ます 12ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
  • 13.
    Private AKS clusterとは 説明  AKS の Control Plane 及び、Node pools が RFC 1918 で定義されている内部 IP ア ドレスのみが割り当てられている cluster を作ることが出来ます  (Control Plane に内包されている) API サーバーとNode pool (内の Node) 間のネ ットワークトラフィックがプライベートネットワークのみに留まるようにす ることが出来ます な、なるほど分からん...(・w・;;) 13ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
  • 14.
    Private AKS clusterとは Azure Power Lunch: Private Azure Kubernetes Service cluster 14
  • 15.
    Create Private AKS cluster PrivateAKS cluster を作ってみよう
  • 16.
    Private AKS cluster作成コマンド ### Resource Group 作成 az group create --location japaneast --name ${private-cluster-resource-group} ### AKS cluster 作成 az aks create --name ${private-cluster-name} --resource-group ${private-cluster-resource-group} --load-balancer-sku standard --enable-private-cluster 16Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
  • 17.
    Private AKS cluster作成コマンド ### Resource Group 作成 az group create --location japaneast --name ${private-cluster-resource-group} ### AKS cluster 作成 az aks create --name ${private-cluster-name} --resource-group ${private-cluster-resource-group} --load-balancer-sku standard --enable-private-cluster 17Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters ※ 2020/03/24 時点での話
  • 18.
    Private AKS cluster作成コマンド 18 GitHub に Bug として Issue 化され済み https://github.com/Azure/azure-cli/issues/9585 一度解決して Merge されたが未だ解決してない模様 (Azure CLI version 2.2.0) しかし、暫定的な解決方法は報告されています!! 素敵ですね!! :)
  • 19.
    Private AKS cluster作成コマンド (修正版) ### Resource Group 作成 az group create --location japaneast --name ${private-cluster-resource-group} ### Service Principal の作成 az ad sp create-for-rbac --name ${service-principal-name} --> appId, password をメモしておく ### AKS cluster 作成 az aks create --name ${private-cluster-name} --resource-group ${private-cluster-resource-group} --load-balancer-sku standard --enable-private-cluster --service-principal ${service-principal-appid} --client-secret ${service-principal-password} 19Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters 修正点 • Service Principal (SP)の作成 • az aks create 時に SP 指定
  • 20.
    Private AKS clusterを Azure portal から確認 20
  • 21.
    Node pools が所属するResource Group の比較 Private AKS cluster の node pools の Resource Group 通常の AKS cluster の node pools の Resource Group 21
  • 22.
    Node pools が所属するResource Group の比較 Private AKS cluster の node pools の Resource Group 通常の AKS cluster の node pools の Resource Group 22 Private DNS zone Private endpoint Network interface が増えている
  • 23.
    Check Point of PrivateAKS cluster Private AKS cluster の注意点
  • 24.
    Private AKS clusterの注意点 1/3 cluster への接続の問題 Azure managed control plane に Public IP Address が無いので Private AKS cluster へのネットワーク接続を確立しなければいけない  ‘az login’ && ‘az aks get-credentials’ だけでは接続出来ない Private AKS cluster に接続する方法  AKS cluster と同じAzure Virtual Network (VNet) 内に VM を作成する  別の Network 内 で VMを作成し、 Virtual network peering を設定する  Express Route or VPN を接続を使う 24Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
  • 25.
    Private AKS clusterの注意点 2/3 構築出来るリージョンに制限がある 今回の GA によって、リージョンの制限が無くなりました!!  日本語 doc の修正が追いついていないので、今なら Preview 時のドキュメントが見れます  https://docs.microsoft.com/ja-jp/azure/aks/private-clusters 25Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
  • 26.
    Private AKS clusterの注意点 3/3 依存関係や制限事項などがあります 詳しくは公式ドキュメントを確認しましょう 依存関係 (Dependencies)  https://docs.microsoft.com/en-us/azure/aks/private-clusters#dependencies 制限事項 (Limitations)  https://docs.microsoft.com/en-us/azure/aks/private-clusters#limitations 26Ref: https://docs.microsoft.com/en-us/azure/aks/private-clusters
  • 27.
    余談 実は GCP にも似たようなcluster があります… Private clusters (限定公開クラスタ)  https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept  2018/10/2 に GA  https://cloud.google.com/kubernetes-engine/docs/release-notes#october-2-2018 27
  • 28.
    余談 実は GCP にも似たようなcluster があります… Private clusters (限定公開クラスタ)  https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept  2018/10/2 に GA  https://cloud.google.com/kubernetes-engine/docs/release-notes#october-2-2018 28 今回の GA により、 やっと追いついた感!!(?)
  • 29.
  • 30.
    個人的に注目している新機能 (2020/03/24 の時点で Preview) Spot Node Pool を AKS cluster にて使う機能  Add a spot node pool to an AKS cluster  https://docs.microsoft.com/en-us/azure/aks/spot-node-pool  Spot VM を用いた Virtual Machine Scale Sets を AKS の Node pool として使用する ことが出来る機能です  コスト削減に大きな期待が出来ます  Spot VMs 等については次ページ参照 30
  • 31.
    個人的に注目している新機能 (2020/03/24 の時点で Preview) Spot VMs について  Use Spot VMs in Azure  https://docs.microsoft.com/en-us/azure/virtual-machines/windows/spot-vms Virtual Machine Scale Sets で Spot VMs を 使う機能  Azure Spot VMs for virtual machine scale sets  https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/use-spot 31
  • 32.
    まとめ Private AKS clusterが GA になりました!!  主にセキュリティ要件において、効果を発揮する(はず)でしょう  依存関係や制限事項があるので、うまく使いこなしましょう  仮にバグがあっても、コミュニティの力で解決する可能性があります 新機能もどんどん出ているので積極的に試しましょう!!  Azure Spot VMs for virtual machine scale sets 等 32
  • 33.
    Enjoy AKS !!;) ♬ ♬ ♪ ♪ ♪ ♬
  • 34.
  • 35.
    資料: 画像系 GitHub: jazug.jp https://github.com/jazug/jazug.jp/ Azure Icons  https://azure.microsoft.com/en-us/patterns/styles/glyphs-icons/ 壁紙作成者様  横井 羽衣子 さん  https://www.facebook.com/uikou 35
  • 36.
    資料: 公式ドキュメント Azure KubernetesService (AKS)  https://azure.microsoft.com/en-us/services/kubernetes-service/ Create a private Azure Kubernetes Service cluster  https://docs.microsoft.com/en-us/azure/aks/private-clusters Kubernetes core concepts for AKS  https://docs.microsoft.com/en-us/azure/aks/concepts-clusters-workloads Security concepts for applications and clusters in AKS  https://docs.microsoft.com/en-us/azure/aks/concepts-security YouTube: Private Azure Kubernetes Service cluster  https://www.youtube.com/watch?v=rgj2nSXkzak 36
  • 37.
    資料: 公式ドキュメント (2020/03/24の時点 で Preview) Add a spot node pool to an Azure Kubernetes Service (AKS) cluster  https://docs.microsoft.com/en-us/azure/aks/spot-node-pool Use Spot VMs in Azure  https://docs.microsoft.com/en-us/azure/virtual-machines/windows/spot-vms Deploy Spot VMs using the Azure portal  https://docs.microsoft.com/en-us/azure/virtual-machines/windows/spot-portal Azure Spot VMs for virtual machine scale sets  https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/use-spot 37
  • 38.
    資料: ドキュメント Azure Kubernetes(AKS) Security Best Practices Part 1 of 4  https://www.stackrox.com/post/2020/01/azure-kubernetes-aks-security-best- practices-part-1-of-4/ 38
  • 39.
    資料: Kubernetes Components 39ref:https://kubernetes.io/docs/concepts/overview/components/

Editor's Notes

  • #31 これじゃない 本当はSpot VMSS を AKS の Scalse set に使えるお話
  • #32 これじゃない 本当はSpot VMSS を AKS の Scalse set に使えるお話