SlideShare uma empresa Scribd logo
1 de 35
Getting Started With AKS
AKSを使い始めましょう!!
第33回 Tokyo Jazug Night (Online)
株式会社 bitFlyer
SRE部 Balaji
自己紹介 : Balaji Venkatachalam (バラジ)
- 2020年9月bitFlyerにジョイン
- SREやってます
- 職歴 :
Before joining bitFlyer, was part of
developing Image processing
applications for Industrial & Life
sciences microscopy.
目次
1. bitFlyerのサービス・技術スタック
2. k8sの説明
3. AKS,ACR,CI/CD,AzureFirewall
4. bitFlyerの実施観点
1. bitFlyerのサービスと技術スタック
販売所・取引所
暗号資産を売買・トレードできます
画像はHPより抜粋
miyabi
プライベートブロックチェーン
bitFlyer Blockchainが企画・開発・運用
主な技術スタック
Blockchain
Webサーバー バックエンド 永続化レイヤー
コード VCS/CI/CD
2. Kubernetes(k8s)の説明
コンテナ化
● クラシックの問題
○ 開発者環境で動くが、
テスト環境に動かな
い
● コンテナイメージで解決
○ アプリおよびその実
行環境を一緒にパッ
ケージングできる
○ コンテナイメージは
Dockerで作られる
コンテナがデストロイこと
● アプリの不具合でコンテナがデストロイ可能性は
ZEROではないです。
○ 再起動は面倒
○ コンテナのHealthのモニタリングはどうやって
するのか
● 上記答えはOrchestratorです。Kubernetesはコンテナ
オーケストレーションエンジンです。
コンテナオーケストレーションエンジンのメリット
スケール、Healthチェック、
LoadBalance、ServiceDiscovery、
Resource制限、など
Kubernetesのしくみ
MASTER NODE
etcd
scheduler
controller
API Server
WORKER NODE
Kubelet
Pod1
Pod2
Kube-proxy
Container
runtime
WORKER NODE
Kubelet Pod1
Pod2
Kube-proxy
Container
runtime
Podは
● 最小単位
● コンテナーアプ
リをHostする
CONTAINERIZED APPLICATIONS
VOLUME
● Isolatedボリュー
ム
● IP Address
Podは適用する方法ーDeployment
● Deployment:Podを作るマニフェスト
DEPLOYMENT
REPLICA SET
POD REPLICA1 POD REPLICA2 POD REPLICA3
Podはデストロイ可能性あり、k8s service 導入
● Podはデストロイさ
れたら新しいPodを
作られるが、
IPAddressは変わる
こと
● だから、kubernetes
はServiceという
Manifestを実施して
ること。
DEPLOYMENT
REPLICA SET
POD REPLICA1
IP: 10.1.1.1
POD REPLICA2
IP: 10.1.1.2
POD REPLICA3
IP: 10.1.1.3
app: a1 app: a1 app: a1
SERVICE
IP: 11.0.0.1
app: a1 selector
複数のサービスはExposeするのは大変
● KubernetesCluster外
に複数サービスを
Exposeすると管理は
大変
● IngressでRoutingを
する。
。。。
Ingress
Controller
ingress
api.app.com
foo.app.com
bar.app.com
まとめすると
。。。
Ingress
Controller
ingress
api.app.com
foo.app.com
bar.app.com
tls termination
cert validation
….など
3. AKS, ACR, CI/CD, Azure Firewall
Why AKS
● AKSは無料Orchestrationサービス
● AKSがControlPlaneやMasterNodeを管理する
● Azure Firewall、Azure VNET、AAD、RBAC、
等
● Node(VM)、ストレージとネットワークリソー
ス以外は全部無料
コンテナイメージをアップロードする方法ーACR
● ACRは
DockerRegistryのよ
うなRegistryです。
● コンテナイメージ、アーティファクト等をアップ
ロード
● VNETとSubnet制限、IP制限、安全
● ジオレプリケーション
● Docker Imagesで確認
● Docker Buildでコンテナイメージを作成
DockerFile
.NETアプリでコンテナイメージを作る
FROM mcr.microsoft.com/dotnet/aspnet:5.0
● 簡単な.NET5アプリを例として作ってみましょう
● DockerFile
COPY bin/Release/net5.0/publish/ App/
WORKDIR /App
ENTRYPOINT ["dotnet", "NetCore.Docker.dll"]
BASE IMAGEを参照する
.NET Publishした後でPublishフォルダで
アプリを展開される。それでCopyをし
てイメージを作る
docker build -t <imagename> -f Dockerfile .
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<image name> latest cd11c3df9b19 41 seconds ago 190MB
コンテナイメージをACRにPushする
● Login
az login
az acr login --name <acrname>
● ImageにTagを付与する
docker tag <image name>:<tag name> <acrLoginServer>/<image name>:<tag name>
● ImageをPushする
docker push <acrLoginServer>/<image name>:<tag name>
ACRからPullしてAKSにインストールする
● Login
az login
az aks get-credentials --name <AKS Cluster name>--resource-group <Resource group>
● kubectlとHelmで管理
● Kubernetes Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: <deployment name>
labels:
app: <app name>
spec:
replicas: 3
selector:
matchLabels:
app: <app name>
template:
metadata:
labels:
app: <app name>
spec:
containers:
- name: <container name>
image: <acrLoginServer>/<image name>:<tag name>
ports:
- containerPort: 9376
Deployment名
Podの3Replicas metadataのlabelを設定する
selectorで管理する
pod名
ContainerのPort
kubectl apply -f deployment.yaml
acrでイメージPullする
● kubectl apply
ServiceとIngressのManifest
apiVersion: v1
kind: Service
metadata:
name: <service name>
spec:
selector:
app: <app name>
ports:
- protocol: TCP
port: 80
targetPort: 9376
Service名
Appと合うLabel
Serviceの
Port
ContainerのPort
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: <ingress name>
spec:
rules:
- host: "foo.bar.com"
http:
paths:
- pathType: Prefix
path: "/bar"
backend:
service:
name: service1
port:
number: 80
- host: "*.foo.com"
http:
paths:
- pathType: Prefix
path: "/foo"
backend:
service:
name: <service name>
port:
number: 80
Ingress名
Host名
Route Rule
対象Service
Serviceの
Port
kubectl apply -f service.yaml
kubectl apply -f ingress.yaml
Package into Helm Chart
● Package Management System
● kubectlで管理は大変
● ACRにPushできる
mychart
-------Charts.yaml #chart info
-------charts#dependent charts
-------templates
-------deployment.yaml
-------service.yaml
-------ingress.yaml
-------values.yaml #default values for templates
● Install方法
● History見れる
helm pull <chart registry path> --version <version> --destination .
helm install <release name> <chart name> [flags]
helm history <release name> [flags]
● 簡単でRollbackできる
helm rollback <RELEASE> [REVISION] [flags]
AzureDevopsPipeline使用して自動化
● AzureDevopsにAzureのサービスの認証と承認は
ServiceConnectionでする
AZURE
DEVOPS
AAD Service Principal
AKS
ACR
AzureDevopsPipeline使用してAutomateする
service connection
ACR Push Token
Helm Taskでも出来る
AzureDevopsPipeline使用してAutomateする
ACR PullToken
service connection
AzureFirewallでAKSを保護する
AKS SUBNET
outbound
inbound
Azure Firewall Subnet
Firewall
private IP
Firewall public
IP
NAT RULE
VNETPeeringで別
のVNETでも接続出
来る。
4. bitFlyerの実施観点
bitFlyerの実装観点
● コンテナイメージとHelmRegistryはACRで管理
● HelmでAKSにアプリを管理
● AzureDevopsPipelineでCI/CD
● TerraformでInfra管理
● Azure FirewallでTraffic制限
● 最近k8sとAKSの運用
結論
● AKSでMicroService監視とScalingは楽になる
● AKSでk8sは無料で出来る。(NetworkやStorageやVM
のコストだけかかる)
● ACRにコンテナイメージとHelmChartの管理は楽にな
る
ご質問?
We’re hiring!
Getting Started With AKS

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Building React, Flutter and Blazor development and debugging environment with...
Building React, Flutter and Blazor development and debugging environment with...Building React, Flutter and Blazor development and debugging environment with...
Building React, Flutter and Blazor development and debugging environment with...
 
[Developers Festa Sapporo 2018] Azure AI ~Microsoft AzureでのAI開発のイマ~
[Developers Festa Sapporo 2018] Azure AI ~Microsoft AzureでのAI開発のイマ~[Developers Festa Sapporo 2018] Azure AI ~Microsoft AzureでのAI開発のイマ~
[Developers Festa Sapporo 2018] Azure AI ~Microsoft AzureでのAI開発のイマ~
 
Building andobservingcloudnativeappliactionusingazure elastic-terraform
Building andobservingcloudnativeappliactionusingazure elastic-terraformBuilding andobservingcloudnativeappliactionusingazure elastic-terraform
Building andobservingcloudnativeappliactionusingazure elastic-terraform
 
DatadogでAWS監視やってみた
DatadogでAWS監視やってみたDatadogでAWS監視やってみた
DatadogでAWS監視やってみた
 
Monitoring the health and performance of your aws environment using the Elast...
Monitoring the health and performance of your aws environment using the Elast...Monitoring the health and performance of your aws environment using the Elast...
Monitoring the health and performance of your aws environment using the Elast...
 
Elastic circle ci-co-webinar-20210127
Elastic circle ci-co-webinar-20210127Elastic circle ci-co-webinar-20210127
Elastic circle ci-co-webinar-20210127
 
Azure Kubernetes Service Overview
Azure Kubernetes Service OverviewAzure Kubernetes Service Overview
Azure Kubernetes Service Overview
 
Azure monitoring and alert v0.2.21.0707
Azure monitoring and alert v0.2.21.0707Azure monitoring and alert v0.2.21.0707
Azure monitoring and alert v0.2.21.0707
 
インフラ野郎AzureチームProX
インフラ野郎AzureチームProXインフラ野郎AzureチームProX
インフラ野郎AzureチームProX
 
[ウェビナー] Build 2018 アップデート ~ データ プラットフォーム/IoT編 ~
[ウェビナー] Build 2018 アップデート ~ データ プラットフォーム/IoT編 ~[ウェビナー] Build 2018 アップデート ~ データ プラットフォーム/IoT編 ~
[ウェビナー] Build 2018 アップデート ~ データ プラットフォーム/IoT編 ~
 
俺的 Ignite Update まとめ 2019
俺的 Ignite Update まとめ 2019俺的 Ignite Update まとめ 2019
俺的 Ignite Update まとめ 2019
 
Elastic 7.13-new-features-20210624
Elastic 7.13-new-features-20210624Elastic 7.13-new-features-20210624
Elastic 7.13-new-features-20210624
 
Real World Azure RBAC
Real World Azure RBACReal World Azure RBAC
Real World Azure RBAC
 
俺の Kubernetes Workflow with HashiStack
俺の Kubernetes Workflow with HashiStack俺の Kubernetes Workflow with HashiStack
俺の Kubernetes Workflow with HashiStack
 
インフラ野郎 Azureチーム at クラウド boost
インフラ野郎 Azureチーム at クラウド boostインフラ野郎 Azureチーム at クラウド boost
インフラ野郎 Azureチーム at クラウド boost
 
ServerlessConf Tokyo2018 サーバーレスなシステムのがんばらない運用監視
ServerlessConf Tokyo2018 サーバーレスなシステムのがんばらない運用監視ServerlessConf Tokyo2018 サーバーレスなシステムのがんばらない運用監視
ServerlessConf Tokyo2018 サーバーレスなシステムのがんばらない運用監視
 
.NETアプリケーションのクラウド最適化
.NETアプリケーションのクラウド最適化.NETアプリケーションのクラウド最適化
.NETアプリケーションのクラウド最適化
 
AKSを活用した社内向けイベント支援プラットフォームをリリースした話
AKSを活用した社内向けイベント支援プラットフォームをリリースした話AKSを活用した社内向けイベント支援プラットフォームをリリースした話
AKSを活用した社内向けイベント支援プラットフォームをリリースした話
 
アプリケーション開発者のためのAzure Databricks入門
アプリケーション開発者のためのAzure Databricks入門アプリケーション開発者のためのAzure Databricks入門
アプリケーション開発者のためのAzure Databricks入門
 
こわくない!Azure 運用管理
こわくない!Azure 運用管理こわくない!Azure 運用管理
こわくない!Azure 運用管理
 

Semelhante a Getting Started With AKS

Semelhante a Getting Started With AKS (20)

Kubernetes Service Account As Multi-Cloud Identity / Cloud Native Security Co...
Kubernetes Service Account As Multi-Cloud Identity / Cloud Native Security Co...Kubernetes Service Account As Multi-Cloud Identity / Cloud Native Security Co...
Kubernetes Service Account As Multi-Cloud Identity / Cloud Native Security Co...
 
AKS と ACI を組み合わせて使ってみた
AKS と ACI を組み合わせて使ってみたAKS と ACI を組み合わせて使ってみた
AKS と ACI を組み合わせて使ってみた
 
これから始めるAzure Kubernetes Service入門
これから始めるAzure Kubernetes Service入門これから始めるAzure Kubernetes Service入門
これから始めるAzure Kubernetes Service入門
 
Qlik TECHTALK Qlik Cloud 日本リージョン開設!テナント作成と移行方法を解説
Qlik TECHTALK Qlik Cloud 日本リージョン開設!テナント作成と移行方法を解説Qlik TECHTALK Qlik Cloud 日本リージョン開設!テナント作成と移行方法を解説
Qlik TECHTALK Qlik Cloud 日本リージョン開設!テナント作成と移行方法を解説
 
5分でわかる Capabilities と Privilege + KubeCon Recap
5分でわかる Capabilities と Privilege + KubeCon Recap5分でわかる Capabilities と Privilege + KubeCon Recap
5分でわかる Capabilities と Privilege + KubeCon Recap
 
Kubernetes etc.. & rancher 2.0 technical preview “Let’s import GKE/Bluemix/AK...
Kubernetes etc.. & rancher 2.0 technical preview “Let’s import GKE/Bluemix/AK...Kubernetes etc.. & rancher 2.0 technical preview “Let’s import GKE/Bluemix/AK...
Kubernetes etc.. & rancher 2.0 technical preview “Let’s import GKE/Bluemix/AK...
 
AngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーション
AngularとSpring Bootで作るSPA + RESTful Web ServiceアプリケーションAngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーション
AngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーション
 
CyberAgent: How We Deployed Production Kubernetes Clusters on OpenStack witho...
CyberAgent: How We Deployed Production Kubernetes Clusters on OpenStack witho...CyberAgent: How We Deployed Production Kubernetes Clusters on OpenStack witho...
CyberAgent: How We Deployed Production Kubernetes Clusters on OpenStack witho...
 
AWSとGCPを使用したインフラ環境
AWSとGCPを使用したインフラ環境AWSとGCPを使用したインフラ環境
AWSとGCPを使用したインフラ環境
 
Rancher 2.0 Technical Preview & Bluemix Kubernetes Cluster Import
Rancher 2.0 Technical Preview & Bluemix Kubernetes Cluster ImportRancher 2.0 Technical Preview & Bluemix Kubernetes Cluster Import
Rancher 2.0 Technical Preview & Bluemix Kubernetes Cluster Import
 
kubetnetes etc.. & Rancher2.0 Technical Preview -import BLUMIX K8S Clusters-
kubetnetes etc.. & Rancher2.0 Technical Preview -import BLUMIX K8S Clusters-kubetnetes etc.. & Rancher2.0 Technical Preview -import BLUMIX K8S Clusters-
kubetnetes etc.. & Rancher2.0 Technical Preview -import BLUMIX K8S Clusters-
 
AKS on Azure Stack HCI/Windows Serverの準備と監視 _ Preparing and monitoring AKS on...
AKS on Azure Stack HCI/Windows Serverの準備と監視 _ Preparing and monitoring AKS on...AKS on Azure Stack HCI/Windows Serverの準備と監視 _ Preparing and monitoring AKS on...
AKS on Azure Stack HCI/Windows Serverの準備と監視 _ Preparing and monitoring AKS on...
 
AKS (k8s) Hands on Lab Contents
AKS (k8s) Hands on Lab ContentsAKS (k8s) Hands on Lab Contents
AKS (k8s) Hands on Lab Contents
 
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャーKubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
 
The Usage and Patterns of MagicOnion
The Usage and Patterns of MagicOnionThe Usage and Patterns of MagicOnion
The Usage and Patterns of MagicOnion
 
OCHaCafe2#5 変幻自在♪ 広がるKubernetesのエコシステム
OCHaCafe2#5 変幻自在♪ 広がるKubernetesのエコシステムOCHaCafe2#5 変幻自在♪ 広がるKubernetesのエコシステム
OCHaCafe2#5 変幻自在♪ 広がるKubernetesのエコシステム
 
4-IBMの2年目とCKAを取得しよう!_1130
4-IBMの2年目とCKAを取得しよう!_11304-IBMの2年目とCKAを取得しよう!_1130
4-IBMの2年目とCKAを取得しよう!_1130
 
コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門
 
Private Azure Kubernetes Service cluster を触ってみよう♪
Private Azure Kubernetes Service cluster を触ってみよう♪Private Azure Kubernetes Service cluster を触ってみよう♪
Private Azure Kubernetes Service cluster を触ってみよう♪
 
半日でわかる コンテナー技術 (応用編)
半日でわかる コンテナー技術 (応用編)半日でわかる コンテナー技術 (応用編)
半日でわかる コンテナー技術 (応用編)
 

Getting Started With AKS