20161028 openshift on azure でasp.net coreと戯れよう
TRANSCRIPT
OpenShift on AzureでASP.NET Core と戯れようTokyo Jazug Night #5
@tanaka_733
自己紹介お仕事◦ OpenShift◦ .NET Core on Red Hat Enterprise Linux (RHEL)◦ Red Hat Solutions on Azure (RHEL, OpenShift etc)
個人◦ Microsoft MVP for Visual Studio andDevelopment Technologies◦ C#, .NET Core
◦ Build InsiderでC#関連の記事を執筆していたりします◦ 最新はRoslyn SDK 拡張連載
今日のGoal
◦OpenShift を知ってもらう
◦AzureのサービスとOpenShiftを連携させてみる
◦OpenShiftでASP.NET Coreを試してみよう
関連IgniteセッションBRK3236Red Hat OpenShift on Microsoft Azure
https://techcommunity.microsoft.com/t5/Microsoft-Ignite-Content/BRK3236-Dive-into-RedHat-s-Openshift-on-Microsoft-Azure/td-p/9562
せっかくなので、OpenShiftについてはこの資料で説明してみましょう
(公開時には引用した部分はリンクのみになります)
kubernetes をみんなで便利に使おう
User Experience
Containerized Service
Orchestration
Container
Container Host
https://www.redhat.com/en/microsoft
https://azure.microsoft.com/campaigns/redhat/
Microsoft
Azure
Dev: single
VM
Dev:
container
…
Community Supported
Commercially Supported
Your choice of infra
OpenShift Online
OpenShift Dedicated
http://docs.openshift.com
OpenShiftConcepts & Architecture Overview
10,000 foot overview
OpenShift runs on your choice of infrastructure
Nodes are instances of RHEL where apps will run
Apps and components run in containers
Container
Image
Container
Pod
Pods are the orchestrated unit in OpenShift
Masters are the Control Plane
API and Authentication
Desired and Current State
Scheduler Pulls From The Registry
Orchestration and Scheduling
Placement by Policy
Services connect application components
Health and Scaling
What about unhealthy Pods?
The Master remediates Pod failures
What about app data?
Routing layer for external accessibility
Access via Web UI, CLI, IDE, API
http://aka.ms/openshift
Master - 10.0.0.0/24 Avail Set: Nodes - 10.0.1.0/24
vNet – 10.0.0.0/16
Master
PIP: 22, 8443, …
Nodes
PIP: 80, 443
Nodes DIP: 22, …
https://keithtenzer.com/2016/10/14/enterprise-container-platform-in-the-cloud-openshift-on-azure-secured-
by-azure-ad/
ASP.NET Core on OpenShift Originon CentOS on Azure今回は、upstream であるOpenShift Originを使い、
OSもAzureですぐに利用できるCentOSを使い構築
今回程度の規模のテスト目的ではSingle VMで十分
動かすアプリは、ASP.NET Coreにしてみました
構築方法Documentに従って進めましょう◦ https://docs.openshift.org/latest/install_config/install/advanced_in
stall.html
◦ Quick InstallよりAdvanced Installの方をお勧めします
ワイルドカードドメイン◦必須ではないが、アプリケーションのルーティング用に使用◦ NameCheapなどで取得し設定◦ 今回は、CNAMEでVMのpublic ip のホスト名を解決するように設定
◦ IPベースで解決でよければ xip.io でも
Azureサービスとの連携ARM Tempaltes◦必要なVM、VNETなど一式を起動するのに便利
AAD OpenID Connect◦ Web Console/CLIの認証に利用可能◦ ADもしくはAAD DSによるLDAP認証も利用可能
OMS◦ Linux VMのログ監視とかメトリクス監視に利用できる(らしい)
S2I ASP.NET Core
DEMO1: s2i とGitHub自動ビルド
s2iイメージによる、コードのビルド+デプロイ
Webhookを利用し、コミットからの自動デプロイも可能
https://goo.gl/tyYhUi
DEMO1α ASP.NET Core 1.1 Preview
まだ、Red Hat公式Dockerイメージはないので、
自作イメージで実行
DEMO2: MVC Auth と Secret
ServiceStackのデモをデプロイ
SecretKeyの格納にOpenShift Secretを使用
https://goo.gl/8FSuGk
DEMO3: EF Core と DB用コンテナ
PostgreSQLのコンテナを利用
Environmentで開発:SQLite,本番:PostgreSQLでEF Core+Migration
https://goo.gl/rWMz8y
DEMO4: Redis 3.2 GeoRadius
ServiceStackのデモをデプロイ
Redis 3.2のコンテナを利用し、GeoRadiusコマンドを使用
https://goo.gl/VUbRfv
DEMO5: SignalR
SignalR-Server が.NET Core1.1必須なので、なんとか動かすのが間に合えば…
https://goo.gl/G9u6xb
今日のまとめ
◦OpenShift を知ってもらう
◦AzureのサービスとOpenShiftを連携させてみる
◦OpenShiftでASP.NET Coreを試してみよう