Skip to content

Instantly share code, notes, and snippets.

@PatrickLang
Last active March 22, 2017 21:56
Show Gist options
  • Save PatrickLang/3d90d84513a112d45254d61f606523d9 to your computer and use it in GitHub Desktop.
Save PatrickLang/3d90d84513a112d45254d61f606523d9 to your computer and use it in GitHub Desktop.
ACS Kubernetes with Windows demo

Using Azure Container Service with Kubernetes and Windows containers

There's still a problem with the PowerShell module & Azure Container Service. For now you'll need to use the portal:

https://docs.microsoft.com/en-us/azure/container-service/container-service-kubernetes-windows-walkthrough

Later, if you'd like to try using PowerShell to deploy a cluster, then follow the next section. Otherwise, skip to "Building & Deploying MusicStore"

Deployment with PowerShell

Prerequite Setup Steps

Get logged in and choose the subscription to interact with

import-module azurerm
Login-AzureRmAccount # This will bring up the login UI
Get-AzureRmSubscription # View Azure subscriptions available to your account. Pick one for the next step
Get-AzureRmSubscription -SubscriptionName mySub |  Select-AzureRmSubscription 

Check who you're logged in as and what context you're using

Get-AzureRmContext

Create a Service Principal

$app = New-AzureRmADApplication -DisplayName "plang-wink8s-sp" -HomePage "http://..." -IdentifierUris "http://..." -password "..."
New-AzureRmADServicePrincipal -ApplicationId $app.ApplicationId
New-AzureRmRoleAssignment -RoleDefinitionName Contributor -ServicePrincipalName $app.ApplicationId

More details: Use Azure PowerShell to create a service principal to access resources About the Azure Active Directory service principal for a Kubernetes cluster in Azure Container Service

Create the ACS cluster

This isn't working quite yet. Needs an update to AzureRm.Compute PowerShell module

# Don't ever share this, but you need to set it
$sshKey = ""

# Adjust these for your deployment
$rgName = "plang-win-k8s_rg"

$masterDnsPrefix= "plangk8s"
$agentDnsPrefix = "winagentgroup"
$location = "westus2"

New-AzureRMResourceGroup -Name $rgName -Location $location -Force
$Container = New-AzureRmContainerServiceConfig -Location $location -OrchestratorType "kubernetes" -MasterDnsPrefix $masterDnsPrefix -AdminUsername "AcsLinuxAdmin" -SshPublicKey $sshKey | Add-AzureRmContainerServiceAgentPoolProfile -Name "AgentPool01" -VmSize "Standard_DS2v2" -DnsPrefix $agentDnsPrefix
New-AzureRmContainerService -ResourceGroupName $rgName -Name "plang-win-k8s" -ContainerService $Container

For more details, see: New-AzureRMResourceGroup New-AzureRmContainerServiceConfig New-AzureRmContainerService

Appendix / maybe unneeded stuff

For more details on this, see Deploy an Azure Resource Manager template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment