Skip to content

Instantly share code, notes, and snippets.

@hadoan
Created June 16, 2020 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadoan/ffbbe806cf3d5eaca0390abbcc2a104b to your computer and use it in GitHub Desktop.
Save hadoan/ffbbe806cf3d5eaca0390abbcc2a104b to your computer and use it in GitHub Desktop.
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as azuread from "@pulumi/azuread";
import { DeploymentConsts } from '../common/consts';
import * as config from '../common/config';
//create Azure AD Application for AKS
export function newAks(resourceGroup: azure.core.ResourceGroup) {
const adApp = new azuread.Application(DeploymentConsts.APP_NAME + '-ad-app');
const adSp = new azuread.ServicePrincipal(DeploymentConsts.APP_NAME + "-aksSp", { applicationId: adApp.applicationId });
const adSpPassword = new azuread.ServicePrincipalPassword("aksSpPassword", {
servicePrincipalId: adSp.id,
value: config.aksPassword,
endDate: "2099-01-01T00:00:00Z",
});
// Create the individual clusters
const cluster = new azure.containerservice.KubernetesCluster(`demo-aksCluster`, {
// Global config arguments
resourceGroupName: resourceGroup.name,
linuxProfile: {
adminUsername: "aksuser",
sshKey: {
keyData: config.sshPublicKey,
},
},
servicePrincipal: {
clientId: adApp.applicationId,
clientSecret: adSpPassword.value,
},
// Per-cluster config arguments
location: azure.Locations.SouthEastAsia,
defaultNodePool: {
name: "aksagentpool",
nodeCount: 3,
vmSize: 'Standard_D2_v2',
},
dnsPrefix: `${pulumi.getStack()}-kube`,
});
return cluster;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment