Home
%3CLINGO-SUB%20id%3D%22lingo-sub-359965%22%20slang%3D%22en-US%22%3EBuilding%20Microservices%20with%20Azure%20Kubernetes%20Service%20and%20Azure%20DevOps%20-%20Part%202%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-359965%22%20slang%3D%22en-US%22%3E%3CP%3E%3CEM%3EIf%20you%20missed%20the%20first%20part%20it%20can%20be%20found%20here%3A%26nbsp%3B%3CBR%20%2F%3E%3CA%20title%3D%22Building%20Microservices%20with%20Azure%20Kubernetes%20Service%20and%20Azure%20DevOps%20-%20Part%201%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-Developer-Community-Blog%2FBuilding-Microservices-with-Azure-Kubernetes-Service-and-Azure%2Fba-p%2F356402%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EBuilding%20Microservices%20with%20Azure%20Kubernetes%20Service%20and%20Azure%20DevOps%20-%20Part%201%3C%2FA%3E%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAfter%20going%20through%20part%201%20the%20preparatory%20steps%20are%20in%20place%2C%20and%20you%20should%20be%20ready%20to%20move%20along%20with%20creating%20a%20k8s%20cluster%20and%20doing%20some%20initial%20configuring%20with%20regards%20to%20permissions.%3C%2FP%3E%3CH2%20id%3D%22toc-hId-1731630643%22%20id%3D%22toc-hId-1731630643%22%20id%3D%22toc-hId-1731630643%22%20id%3D%22toc-hId-1731630643%22%20id%3D%22toc-hId-1731630643%22%20id%3D%22toc-hId-1731630643%22%20id%3D%22toc-hId-1731630643%22%20id%3D%22toc-hId-1731630643%22%3E%3CSPAN%3ECreating%20the%20AKS%20cluster%3C%2FSPAN%3E%3C%2FH2%3E%3CP%3EThe%20first%20step%20for%20using%20the%20Azure%20CLI%20is%20logging%20in%3A%3C%2FP%3E%3CPRE%3E%3CSPAN%3Eaz%20login%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20974px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F85028iB7012BC3FCDA6683%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22AZ_CLI_01.png%22%20title%3D%22AZ_CLI_01.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CEM%3EFigure%2026%20az%20login%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20you%20have%20multiple%20subscriptions%20in%20Azure%20you%20might%20need%20to%20use%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3Eaz%20account%20list%3C%2FSPAN%3E%3CSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3Eaz%20account%20set%20--subscription%20xyz%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%3Eto%20make%20sure%20you're%20working%20on%20the%20right%20one.%20(Verify%20the%20value%20of%20the%20%3CEM%3EisDefault%3C%2FEM%3E%20attribute%20to%20see%20which%20one%20the%20default%20is.)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EA%20resource%20group%20to%20contain%20the%20AKS%20instance%20is%20also%20needed.%20Technically%20it%20doesn't%20matter%20which%20location%20you%20deploy%20the%20resource%20group%20to%2C%20but%20the%20suggestion%20is%20going%20with%20a%20location%20that%20is%20supported%20for%20AKS%20clusters%20and%20stick%20with%20it%20throughout%20the%20setup.%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3Eaz%20group%20create%20--name%20aksdotnetcoder%20--location%20northeurope%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%3ENext%20comes%20creation%20of%20the%20AKS%20cluster%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%3Eaz%20aks%20create%20--name%20aksdotnet%20--resource-group%20aksdotnetcoder%20--node-count%201%20--generate-ssh-keys%20--enable-addons%20http_application_routing%20-%E2%80%93aad-server-app-id%20x%20%E2%80%93-aad-server-app-secret%20x%20%E2%80%93-aad-client-app-id%20x%20-%E2%80%93aad-tenant-id%20x%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E--kubernetes-version%201.x.y%20--node-vm-size%20Standard_DS1_v2%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20979px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F85029iEF2F40B1286FF7C0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22AZ_CLI_02.png%22%20title%3D%22AZ_CLI_02.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CEM%3EFigure%2027%20az%20aks%20create%3C%2FEM%3E%3C%2FP%3E%3CP%3ENote%3A%20Some%20of%20the%20documentation%20articles%20online%20will%20include%20%3CEM%3E-%E2%80%93enable-rbac%3C%2FEM%3E%20as%20an%20argument.%20This%20has%20been%20deprecated%2C%20and%20by%20default%20all%20AKS%20clusters%20created%20with%20Azure%20CLI%20will%20have%20RBAC%20enabled%20unless%20you%20specifically%20disable%20it%20by%20using%20the%20inverse%20parameter%20%3CEM%3E%E2%80%93-disable-rbac%3C%2FEM%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20specific%20version%20of%20Kubernetes%20is%20provided%20in%20the%20parameter%20list%20here%20even%20though%20that%20seems%20to%20be%20a%20low-level%20detail%20when%20dealing%20with%20a%20managed%20service.%20Kubernetes%20is%20a%20fast-moving%20target%20and%20sometimes%20it%20will%20be%20necessary%20to%20be%20on%20specific%20versions%20for%20specific%20features%20and%2For%20compatibility%20reasons.%201.12.6%20is%20the%20newest%20version%20as%20of%20writing%20this.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20get%20a%20list%20of%20versions%20run%20the%20following%20command%3A%3C%2FP%3E%3CPRE%3E%3CBR%20%2F%3E%3CSPAN%3Eaz%20aks%20get-versions%20--location%20%22location%22%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3EIf%20this%20parameter%20is%20omitted%20a%20default%20version%20will%20be%20chosen%2C%20but%20it%20is%20not%20guaranteed%20to%20be%20the%20latest%20version.%20Since%20AKS%20is%20a%20managed%20service%20there%20may%20also%20be%20delays%20between%20new%20releases%20by%20the%20Kubernetes%20team%20and%20the%20time%20it%20becomes%20available%20in%20Azure.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExisting%20clusters%20can%20be%20upgraded%20to%20a%20newer%20version%20with%20the%20click%20of%20a%20button%20in%20the%20Azure%20Portal%20or%20through%20the%20Azure%20CLI%3A%3C%2FP%3E%3CPRE%3E%3CSPAN%3Eaz%20aks%20upgrade%20--kubernetes-version%20%E2%80%93name%20foo%20--resource-group%20bar%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3ETo%20keep%20costs%20down%20for%20a%20test%20environment%20only%20one%20node%20is%20used%2C%20but%20in%20production%20one%20should%20ramp%20up%20to%20at%20least%203%20for%20high%20availability%20and%20scale.%20The%20VM%20size%20is%20specified%20to%20be%20of%20the%20%3CEM%3EDS1_v2%3C%2FEM%3E%20type.%20(This%20is%20also%20the%20default%20if%20you%20omit%20the%20parameter.)%20It%20is%20possible%20to%20choose%20lower%20performing%20SKUs%2C%20but%20the%20performance%20takes%20a%20severe%20hit%20which%20will%20be%20noticed%20when%20pulling%20and%20deployment%20images%20later%20in%20this%20guide%2C%20so%20it%20is%20not%20advised%20to%20do%20so.%20For%20production%20use%20you%20should%20have%20a%20closer%20look%20at%20the%20available%20VM%20SKUs%20to%20make%20a%20choice%20as%20to%20which%20one%20you%20want%20to%20use.%20(Note%20that%20the%20availability%20might%20vary%20between%20regions.)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20brings%20out%20another%20value-adding%20feature%20of%20AKS.%20In%20a%20Kubernetes%20cluster%20you%20have%20management%20nodes%20and%20worker%20nodes.%20Just%20like%20one%20would%20need%20more%20than%20one%20worker%20to%20distribute%20the%20load%2C%20one%20needs%20multiple%20managers%20to%20have%20high%20availability.%20AKS%20takes%20care%20of%20the%20management%2C%20but%20not%20only%20does%20the%20service%20abstract%20away%20the%20management%20nodes%20-%20you%20don't%20pay%20for%20them%20either.%20You%20pay%20for%20the%20nodes%2C%20and%20that's%20it.%20(Disclaimer%3A%20the%20author%20cannot%20guarantee%20the%20current%20model%20will%20be%20in%20effect%20for%20perpetuity.)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20creation%20of%20the%20cluster%20should%20take%2010-15%20minutes.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20make%20sure%20that%20things%20are%20in%20a%20good%20state%20verify%20the%20cluster%20is%20working%20before%20proceeding.%20Run%20the%20following%20command%20to%20retrieve%20the%20correct%20files%20for%20the%20Kubernetes%20tools%20to%20work%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%3Eaz%20aks%20get-credentials%20--resource-group%20aksdotnetcoder%20--name%20aksdotnet%20--admin%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3ERun%26nbsp%3B%3CEM%3Ekubectl%20get%20nodes%3C%2FEM%3E%2C%20which%20should%20look%20similar%20to%20this%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20527px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F85030iF308EE88252FE96A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22kubectl_01.png%22%20title%3D%22kubectl_01.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CEM%3EFigure%2028%20kubectl%20get%20nodes%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH3%20id%3D%22toc-hId--1017039823%22%20id%3D%22toc-hId--1017039823%22%20id%3D%22toc-hId--1017039823%22%20id%3D%22toc-hId--1017039823%22%20id%3D%22toc-hId--1017039823%22%20id%3D%22toc-hId--1017039823%22%20id%3D%22toc-hId--1017039823%22%20id%3D%22toc-hId--1017039823%22%3EYAML%20%E2%80%93%20The%20Configuration%20Language%20of%20Kubernetes%3C%2FH3%3E%3CP%3EThe%20subsequent%20sections%20will%20make%20heavy%20use%20of%20Yet%20Another%20Markup%20Language%20(YAML)%20for%20configuring%20k8s.%20XML%20used%20to%20be%20a%20commonly%20used%20format%20for%20configuration%20files%2C%20and%20JSON%20has%20become%20more%20frequent%20in%20the%20past%20couple%20of%20years.%20Kubernetes%20uses%20YAML%20instead%20for%20most%20common%20configurations.%20(Both%20options%20are%20demonstrated%20in%20this%20guide.)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYAML%20is%20not%20a%20format%20specific%20for%20Kubernetes%2C%20but%20if%20you%20aren%E2%80%99t%20familiar%2C%20it%20is%20important%20to%20understand%20that%20indentation%20matters.%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3ESetting%3A%20foo%3CBR%20%2F%3EValue%3A%20bar%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3EIs%20entirely%20different%20from%3C%2FP%3E%3CPRE%3E%3CSPAN%3ESetting%3A%20foo%0A%20%20Value%3A%20bar%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3EYou%20should%20use%20spaces%20for%20this%20indentation%3B%20not%20tabs.%20You%20might%20get%20informative%20error%20messages%2C%20and%20in%20Visual%20Studio%20Code%20there%20are%20plugins%20that%20can%20provide%20hints%2C%20but%20if%20you%20get%20errors%20even%20though%20you%20copied%20and%20pasted%20the%20snippets%20here%20check%20that%20there%20haven%E2%80%99t%20been%20some%20auto-formatting%20reorganizing%20things.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH3%20id%3D%22toc-hId-725770512%22%20id%3D%22toc-hId-725770512%22%20id%3D%22toc-hId-725770512%22%20id%3D%22toc-hId-725770512%22%20id%3D%22toc-hId-725770512%22%20id%3D%22toc-hId-725770512%22%20id%3D%22toc-hId-725770512%22%20id%3D%22toc-hId-725770512%22%3EEnabling%20RBAC%20for%20users%3C%2FH3%3E%3CP%3EThe%20%3CEM%3E-%E2%80%93admin%3C%2FEM%3E%20parameter%20gave%20us%20admin%20access%2C%20but%20it%20hasn%E2%80%99t%20been%20applied%20permanently%20for%20RBAC%20for%20work.%20To%20do%20so%20create%20a%20file%20called%20%3CEM%3Euser-rbac.yaml%3C%2FEM%3E%20and%20paste%20in%20the%20following%20content%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%3EapiVersion%3A%20rbac.authorization.k8s.io%2Fv1%3CBR%20%2F%3Ekind%3A%20ClusterRoleBinding%3CBR%20%2F%3Emetadata%3A%3CBR%20%2F%3E%20%20name%3A%20aksdotnet-cluster-admins%3CBR%20%2F%3EroleRef%3A%3CBR%20%2F%3E%20%20apiGroup%3A%20rbac.authorization.k8s.io%3CBR%20%2F%3E%20%20kind%3A%20ClusterRole%3CBR%20%2F%3E%20%20name%3A%20cluster-admin%3CBR%20%2F%3Esubjects%3A%3CBR%20%2F%3E-%20apiGroup%3A%20rbac.authorization.k8s.io%3CBR%20%2F%3E%20%20kind%3A%20User%3CBR%20%2F%3E%20%20name%3A%20user%40contoso.com%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3EReplace%20%3CEM%3Euser%40contoso.com%3C%2FEM%3E%20with%20your%20user%20name.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20file%20needs%20to%20be%20applied%20by%20running%20%3CEM%3Ekubectl%20create%20-f%20user-rbac.yaml%3C%2FEM%3E%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20667px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F85147iD1BFB579CB1F4A4A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22kubectl_02.png%22%20title%3D%22kubectl_02.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CEM%3EFigure%2029%20kubectl%20create%20User%20RBAC%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIn%20practice%2C%20you%20want%20to%20apply%20this%20on%20a%20group%20level%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E.%20To%20do%20so%20replace%20the%20last%20two%20lines%20with%20the%20following%20(with%20the%20objectId%20for%20the%20group)%3A%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3Ekind%3A%20Group%3CBR%20%2F%3Ename%3A%20%22guid%22%3C%2FSPAN%3E%3C%2FPRE%3E%3CH3%20id%3D%22toc-hId--1826386449%22%20id%3D%22toc-hId--1826386449%22%20id%3D%22toc-hId--1826386449%22%20id%3D%22toc-hId--1826386449%22%20id%3D%22toc-hId--1826386449%22%20id%3D%22toc-hId--1826386449%22%20id%3D%22toc-hId--1826386449%22%20id%3D%22toc-hId--1826386449%22%3E%26nbsp%3B%3C%2FH3%3E%3CH3%20id%3D%22toc-hId--83576114%22%20id%3D%22toc-hId--83576114%22%20id%3D%22toc-hId--83576114%22%20id%3D%22toc-hId--83576114%22%20id%3D%22toc-hId--83576114%22%20id%3D%22toc-hId--83576114%22%20id%3D%22toc-hId--83576114%22%20id%3D%22toc-hId--83576114%22%3EEnabling%20RBAC%20for%20the%20Kubernetes%20Dashboard%3C%2FH3%3E%3CP%3EThese%20steps%20make%20sure%20you%20can%20use%20the%20%3CEM%3Ekubectl%3C%2FEM%3E%20command%20line%20options%2C%20but%20there%20is%20also%20a%20web-based%20dashboard%20one%20can%20use%20for%20managing%20an%20AKS%20cluster.%20However%2C%20this%20involves%20a%20service%20account%20which%20we%20have%20not%20assigned%20permissions%20to%20yet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20assign%20these%20permissions%20create%20a%20file%20called%20%3CEM%3Edashboard-admin.yaml%3C%2FEM%3E%20with%20the%20following%20contents%3A%3C%2FP%3E%3CPRE%3E%3CSPAN%3EapiVersion%3A%20rbac.authorization.k8s.io%2Fv1%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3Ekind%3A%20ClusterRoleBinding%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3Emetadata%3A%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20name%3A%20kubernetes-dashboard%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20labels%3A%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%20%20k8s-app%3A%20kubernetes-dashboard%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3EroleRef%3A%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20apiGroup%3A%20rbac.authorization.k8s.io%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20kind%3A%20ClusterRole%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20name%3A%20cluster-admin%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3Esubjects%3A%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E-%20kind%3A%20ServiceAccount%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20name%3A%20kubernetes-dashboard%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20namespace%3A%20kube-system%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3EApply%20with%3C%2FP%3E%3CPRE%3E%3CSPAN%3Ekubectl%20create%20-f%20dashboard-admin.yaml%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3EYou%20can%20now%20verify%20that%20it%20is%20possible%20to%20open%20the%20Kubernetes%20dashboard%20by%20running%3C%2FP%3E%3CPRE%3E%3CSPAN%3Eaz%20aks%20browse%20--resource-group%20aksdotnetcoder%20--name%20aksdotnet%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20979px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F85149iE4958DBB7B3283DE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22kubectl_03.png%22%20title%3D%22kubectl_03.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CEM%3EFigure%2030%20az%20aks%20browse%3C%2FEM%3E%3C%2FP%3E%3CP%3EThis%20will%20launch%20a%20browser%20with%20the%20graphical%20representation%20of%20your%20cluster%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20573px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F85150i6C99DB35FD116798%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22kubedash_01.png%22%20title%3D%22kubedash_01.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CEM%3EFigure%2031%20Kubernetes%20Dashboard%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3E%3CSPAN%3EKubectl%3C%2FSPAN%3E%3C%2FEM%3E%3CSPAN%3E%20also%20allows%20for%20connecting%20to%20the%20dashboard%20(%3CEM%3Ekubectl%20proxy%3C%2FEM%3E)%20but%20by%20using%20the%20Azure%20CLI%20everything%20is%20automatically%20piggybacked%20onto%20the%20current%20authenticated%20Azure%20session.%20Notice%20that%20the%20address%20is%20127.0.0.1%20even%20though%20it%20isn't%20local.%20That's%20just%20some%20proxy%20tricks%20where%20the%20traffic%20is%20tunneled%20through%20to%20Azure.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIt%20could%20be%20argued%20that%20enabling%20the%20dashboard%20opens%20another%20attack%20vector%20and%20that%20it%20would%20be%20preferable%20to%20stick%20to%20%3CEM%3Ekubectl%3C%2FEM%3E.%20There%20are%20valid%20arguments%20for%20this%20school%20of%20thought%2C%20and%20it%E2%80%99s%20also%20true%20that%20certain%20actions%20can%20only%20be%20carried%20out%20through%20%3CEM%3Ekubectl%3C%2FEM%3E.%20It%20is%20however%20also%20often%20faster%20to%20get%20an%20overview%20from%20a%20web%20browser%2C%20and%20when%20learning%20Kubernetes%2C%20it%20is%20very%20helpful%20to%20have%20a%20graphical%20representation.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH3%20id%3D%22toc-hId-1659234221%22%20id%3D%22toc-hId-1659234221%22%20id%3D%22toc-hId-1659234221%22%20id%3D%22toc-hId-1659234221%22%20id%3D%22toc-hId-1659234221%22%20id%3D%22toc-hId-1659234221%22%20id%3D%22toc-hId-1659234221%22%20id%3D%22toc-hId-1659234221%22%3E%3CSPAN%3ERBAC%20for%20Helm%20and%20installation%20of%20the%20binaries%20into%20the%20cluster%3C%2FSPAN%3E%3C%2FH3%3E%3CP%3E%3CSPAN%3EIt%20was%20mentioned%20previously%20that%20%3CEM%3EHelm%3C%2FEM%3E%20is%20a%20sort%20of%20package%20manager%20for%20Kubernetes.%20This%20applies%20to%20both%20the%20software%20packages%20you%20build%20yourself%2C%20and%20those%20supplied%20by%20other%20parties.%20The%20RBAC%20model%20we%20have%20in%20place%20requires%20that%20we%20specifically%20need%20to%20enable%20support%20for%20%3CEM%3EHelm%3C%2FEM%3E%20to%20work%20properly.%20This%20can%20be%20done%20with%20the%20following%20yaml%3A%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3EapiVersion%3A%20v1%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3Ekind%3A%20ServiceAccount%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3Emetadata%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%20%20%3CSPAN%3Ename%3A%20tiller%3C%2FSPAN%3E%3CBR%20%2F%3E%20%20%3CSPAN%3Enamespace%3A%20kube-system%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E---%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EapiVersion%3A%20rbac.authorization.k8s.io%2Fv1%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3Ekind%3A%20ClusterRoleBinding%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3Emetadata%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%20%20%3CSPAN%3Ename%3A%20tiller%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EroleRef%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%20%20%3CSPAN%3EapiGroup%3A%20rbac.authorization.k8s.io%3C%2FSPAN%3E%3CBR%20%2F%3E%20%20%3CSPAN%3Ekind%3A%20ClusterRole%3C%2FSPAN%3E%3CBR%20%2F%3E%20%20%3CSPAN%3Ename%3A%20cluster-admin%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3Esubjects%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E-%20kind%3A%20ServiceAccount%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3Bname%3A%20tiller%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3Bnamespace%3A%20kube-system%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EApply%20with%20%3CEM%3Ekubectl%20create%20-f%20helm-rbac.yaml%3C%2FEM%3E.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIt%20might%20not%20be%20apparent%20from%20the%20definition%2C%20but%20%3CEM%3ETiller%3C%2FEM%3E%20is%20the%20server%20component%2C%20and%20%3CEM%3EHelm%3C%2FEM%3E%20is%20the%20client-side%20component.%20(Thus%2C%20we%20use%20%3CEM%3Etiller%3C%2FEM%3E%20in%20the%20naming%20even%20though%20this%20is%20not%20a%20hardcoded%20requirement.)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CEM%3E%3CSPAN%3EHelm%3C%2FSPAN%3E%3C%2FEM%3E%3CSPAN%3E%20needs%20to%20be%20primed%20as%20well%20to%20be%20ready%20for%20later.%20Based%20on%20having%20a%20working%20cluster%20as%20verified%20in%20the%20previous%20step%2C%20%3CEM%3Ehelm%3C%2FEM%3E%20will%20automagically%20work%20out%20where%20to%20apply%20its%20logic.%20You%20can%20have%20multiple%20clusters%20so%20part%20of%20the%20point%20in%20verifying%20the%20cluster%20is%20ok%20is%20to%20make%20sure%20you're%20connected%20to%20the%20right%20one.%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EApply%20the%20following%3A%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3EHelm%20init%20%E2%80%93-service-account%20tiller%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EHelm%20repo%20update%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20979px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F85151i088D60D93013FA6E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Helm_01.png%22%20title%3D%22Helm_01.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CEM%3EFigure%2032%20helm%20init%20and%20repo%20update%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20cluster%20should%20now%20be%20ready%20to%20have%20images%20deployed.%20Which%20leads%20to%20another%20topic%20-%20management%20of%20images.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EMuch%20like%20one%20refers%20to%20images%20when%20building%20virtual%20machines%2C%20Docker%20uses%20the%20same%20concept%20although%20slightly%20different%20on%20the%20implementation%20level.%20To%20get%20running%20containers%20inside%20a%20Kubernetes%20cluster%20you%20need%20a%20repository%20for%20these%20images.%20The%20default%20public%20repo%20is%20%3CEM%3EDocker%20Hub%3C%2FEM%3E%2C%20and%20images%20stored%20there%20will%20be%20entirely%20suited%20for%20your%20AKS%20cluster.%20(In%20fact%2C%20third-party%20images%20will%20be%20acquired%20from%20%3CEM%3EDocker%20Hub%3C%2FEM%3E%20for%20completion%20of%20the%20guide%E2%80%99s%20setup.)%20However%2C%20it%20is%20not%20needed%20to%20have%20your%20images%20available%20on%20the%20Internet.%20This%20requires%20use%20of%20a%20private%20repository%20instead%20of%20%3CEM%3EDocker%20Hub%3C%2FEM%3E.%20In%20the%20Azure%20ecosystem%20this%20is%20delivered%20by%20%3CEM%3EAzure%20Container%20Registry%3C%2FEM%3E%20(ACR).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThis%20setup%20can%20be%20done%20in%20the%20Azure%20Portal%2C%20but%20for%20coherency%20the%20CLI%20is%20used%20here.%20It%20can%20be%20placed%20in%20the%20same%20resource%20group%20as%20the%20AKS%20cluster%2C%20but%20since%20a%20registry%20logically%20speaking%20is%20a%20separate%20entity%20a%20new%20group%20will%20be%20created%20for%20the%20registry.%20This%20means%20it%20more%20visibly%20lends%20itself%20to%20be%20re-used%20across%20clusters%20too.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22toc-hId--696409235%22%20id%3D%22toc-hId--696409235%22%20id%3D%22toc-hId--696409235%22%20id%3D%22toc-hId--696409235%22%20id%3D%22toc-hId--696409235%22%20id%3D%22toc-hId--696409235%22%20id%3D%22toc-hId--696409235%22%20id%3D%22toc-hId--696409235%22%3E%3CSPAN%3ESetting%20up%20Azure%20Container%20Registry%20(ACR)%3C%2FSPAN%3E%3C%2FH2%3E%3CP%3E%3CSPAN%3ECreate%20a%20resource%20group%3A%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3Eaz%20group%20create%20--name%20aks-acr-rg%20--location%20northeurope%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%3ECreate%20an%20Azure%20Container%20Registry%20with%20the%20Basic%20SKU%3A%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3Eaz%20acr%20create%20--resource-group%20aks-acr-rg%20--name%20aksdotnetacr%20--sku%20Basic%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%3ESince%20the%20registry%20name%20needs%20to%20be%20globally%20unique%20you%20need%20to%20come%20up%20with%20your%20own%20moniker%20for%20the%20name%20parameter.%20The%20SKU%20choice%20is%20largely%20driven%20by%20the%20need%20for%20scalability.%20More%20details%20can%20be%20found%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fpricing%2Fdetails%2Fcontainer-registry%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fpricing%2Fdetails%2Fcontainer-registry%2F%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EWhile%20you%20can%20now%20browse%20the%20contents%20of%20the%20registry%20in%20the%20portal%20that%20does%20not%20mean%20that%20your%20cluster%20can%20do%20so.%20As%20is%20indicated%20by%20the%20message%20upon%20successful%20creation%20of%20the%20ACR%20component%20we%20need%20to%20create%20a%20service%20principal%20that%20will%20be%20used%20by%20Kubernetes%2C%20and%20we%20need%20to%20give%20this%20service%20principal%20access%20to%20ACR.%20If%20you're%20new%20to%20the%20concept%20of%20authentication%20in%20Azure%20AD%20this%20statement%20doesn't%20explain%20what%20a%20service%20principal%20is%2C%20but%20you%20can%20think%20of%20it%20as%20a%20user%20account%20for%20applications%20in%20this%20context.%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThis%20is%20one%20of%20those%20things%20that%20are%20easier%20to%20do%20in%20the%20PowerShell%20ISE%3A%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3E%23%20Get%20the%20id%20of%20the%20service%20principal%20configured%20for%20AKS%3CBR%20%2F%3E%24AKS_RESOURCE_GROUP%20%3D%20%22aksdotnetcoder%22%3CBR%20%2F%3E%24AKS_CLUSTER_NAME%20%3D%20%22aksdotnet%22%3CBR%20%2F%3E%24CLIENT_ID%3D%24(az%20aks%20show%20--resource-group%20%24AKS_RESOURCE_GROUP%20--name%20%24AKS_CLUSTER_NAME%20--query%20%22servicePrincipalProfile.clientId%22%20--output%20tsv)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%23%20Get%20the%20ACR%20registry%20resource%20id%3CBR%20%2F%3E%24ACR_NAME%20%3D%20%22aksdotnetacr%22%3CBR%20%2F%3E%24ACR_RESOURCE_GROUP%20%3D%20%22aks-acr-rg%22%3CBR%20%2F%3E%24ACR_ID%3D%24(az%20acr%20show%20--name%20%24ACR_NAME%20--resource-group%20%24ACR_RESOURCE_GROUP%20--query%20%22id%22%20--output%20tsv)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%23Create%20role%20assignment%3CBR%20%2F%3Eaz%20role%20assignment%20create%20--assignee%20%24CLIENT_ID%20--role%20Reader%20--scope%20%24ACR_ID%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20508px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F85152iCF954949D4337B5E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22ACR_01.png%22%20title%3D%22ACR_01.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CEM%3EFigure%2033%20PowerShell%20ISE%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20AKS%20cluster%20should%20now%20be%20in%20a%20state%20where%20it%20is%20ready%20for%20deployment%20of%20services%2C%20and%20the%20next%20steps%20are%20to%20create%20the%20following%20recipes%20for%20Azure%20DevOps%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CUL%3E%3CLI%3E%3CSPAN%3EHow%20Azure%20DevOps%20should%20build%20the%20code.%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3EHow%20Azure%20DevOps%20should%20push%20the%20resulting%20artifacts%20to%20Azure%20Container%20Registry.%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3EHow%20Azure%20DevOps%20should%20deploy%20containers.%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe're%20on%20a%20roll%20here%2C%20but%20it%20feels%20like%20a%20natural%20point%20to%20take%20a%20little%20break%20before%20going%20back%20to%20Azure%20DevOps%20in%20the%20next%20part.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-359965%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20a%20multi-post%20walkthrough%20we%20take%20a%20tour%20through%20setting%20up%20building%20and%20deploying%20microservices%20on%20Azure%20through%20using%20Azure%20Kubernetes%20Service%20(AKS)%20and%20Azure%20DevOps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20part%20deals%20with%20creating%20the%20cluster%2C%20enabling%20RBAC%20and%20connecting%20to%20Azure%20Container%20Registry.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-SUB%20id%3D%22lingo-sub-622699%22%20slang%3D%22en-US%22%3ERe%3A%20Building%20Microservices%20with%20Azure%20Kubernetes%20Service%20and%20Azure%20DevOps%20-%20Part%202%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-622699%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F186188%22%20target%3D%22_blank%22%3E%40Andreas%20Helland%3C%2FA%3E%3CSPAN%3E%2C%3CBR%20%2F%3EGreat%20article.%20I%20have%20done%20the%20configurations%20in%20the%201st%20part%20and%20got%20the%20following%20error%20in%202nd%20part%20in%20this%20step%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3Eaz%20group%20create%20--name%20aksdotnetcoder%20--location%20northeurope%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3EThe%20subscription%20'691b6138-2a41-4ba4-b908-cec01314d78c'%20is%20disabled%20and%20therefore%20marked%20as%20read%20only.%20You%20cannot%20perform%20any%20write%20actions%20on%20this%20subscription%20until%20it%20is%20re-enabled.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20only%20trial%20subscription.%20Is%20it%20okay%20or%20need%20to%20pay%20to%20continue%20this%20process.%20Is%20it%20necessary%3CFONT%20face%3D%22inherit%22%3E%26nbsp%3Bto%20pay%2C%20What%20is%20your%20%3C%2FFONT%3Erecommended%26nbsp%3B%3CFONT%20face%3D%22inherit%22%3Esubscription%20for%20R%26amp%3BD%20purpose%3F%20Is%20there%20any%20%3C%2FFONT%3Epossibilities%3CFONT%20face%3D%22inherit%22%3E%26nbsp%3Bto%20try%20it%20free%20for%20test%2Fdevelopment%3F%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22inherit%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20826px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F115498i0265BE37064B0BC4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture.JPG%22%20title%3D%22Capture.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-624016%22%20slang%3D%22en-US%22%3ERe%3A%20Building%20Microservices%20with%20Azure%20Kubernetes%20Service%20and%20Azure%20DevOps%20-%20Part%202%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624016%22%20slang%3D%22en-US%22%3E%3CDIV%3E%3CFONT%3EPersonally%20I%20use%20both%20a%20PAYG%20(Pay%20as%20you%20go)%20subscription%20as%20well%20as%20Azure%20credits%20from%20an%20MSDN%20subscription%20for%20lab%20work.%20Which%20is%20suitable%20for%20most%20of%20my%20needs%2C%20but%20of%20course%20MSDN%20has%20a%20cost%20in%20itself%20so%20unless%20someone%20else%20is%20picking%20up%20that%20tab%20it's%20probably%20cheaper%20to%20pay%20directly%20for%20resources%20consumed.%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CFONT%3EAzure%20has%20a%20lot%20of%20services%20with%20a%20free%20tier%20where%20lab%20use%20costs%20nothing.%20Unfortunately%20AKS%20is%20not%20one%20of%20those%20services%20since%20it%20requires%20allocating%20non-shared%20VMs%20to%20you.%20If%20the%20purpose%20is%20to%20just%20spin%20up%20the%20resources%20in%20this%20blog%20series%20and%20deploying%20a%20test%20service%20we're%20talking%20about%20barely%20visible%20amounts%20on%20your%20credit%20card.%20With%20storage%2C%20container%20registry%2C%20and%20VM%20I%20believe%20I%20rack%20up%20roughly%2050%24%20a%20month%20when%20I%20don't%20bother%20with%20deprovisioning%2C%20shutting%20down%2C%20etc.%3C%2FFONT%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-633197%22%20slang%3D%22en-US%22%3ERe%3A%20Building%20Microservices%20with%20Azure%20Kubernetes%20Service%20and%20Azure%20DevOps%20-%20Part%202%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-633197%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20a%20lot%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F186188%22%20target%3D%22_blank%22%3E%40Andreas%20Helland%3C%2FA%3E%20.%20Now%20I%20got%20a%20student%20subscription%20and%20done%20the%20above%20step.%20Now%20I%20got%20another%20issue%20in%20the%20following%20step.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20917px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F115656i24FEF949256602A9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture1.JPG%22%20title%3D%22Capture1.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20checked%20the%20following%20as%20well.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20936px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F115657i1AFBD11D0C510D95%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture3.JPG%22%20title%3D%22Capture3.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20I%20also%20added%20my%20yaml%20files%20here.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F115658iAEA1C9EC89AF844D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture4.JPG%22%20title%3D%22Capture4.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20please%20give%20me%20any%20suggestions%20to%20solve%20this%20problem.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3ECroos.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-633608%22%20slang%3D%22en-US%22%3ERe%3A%20Building%20Microservices%20with%20Azure%20Kubernetes%20Service%20and%20Azure%20DevOps%20-%20Part%202%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-633608%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F186188%22%20target%3D%22_blank%22%3E%40Andreas%20Helland%3C%2FA%3E%20%2C%3C%2FP%3E%3CP%3EI%20found%20the%20solution%20for%20the%20above%26nbsp%3B%3CSPAN%3Eissue.%20using%20the%20following%20role%20binding.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ekubectl%20create%20rolebinding%20xxxxxxxxxxxxxxxxxxxxxxxxxxxxxf-admin-binding%20--clusterrole%3Dadmin%20--user%3Dxxxxxxxxxxxxxxxxxxxxxxx%20--namespace%3Dkube-system.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EAnd%20I%20got%20another%20issue%20in%20the%20following%26nbsp%3B%3CSPAN%3E%E2%80%93-service-account%3C%2FSPAN%3E%20flag.%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CFONT%20face%3D%22SegoeUI%2CLato%2C%26quot%3BHelvetica%20Neue%26quot%3B%2CHelvetica%2CArial%2Csans-serif%22%3Eh%3CSPAN%3Eelm.exe%20init%20%E2%80%93-service-account%20tiller%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3BThen%20I%20tried%20with%20out%20flag%2C%20That%20is%20also%20working.%20Some%20how%20I%20completed%20all%20the%20setups%20in%20this%20part%20up%20to%26nbsp%3B%3CSPAN%3EPowerShell%20%3C%2FSPAN%3Escript.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eunfortunately%20I%20got%20this%20error%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F115668iE91BE23327C0F71A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture6.JPG%22%20title%3D%22Capture6.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDO%20you%20have%20any%20suggestions%20on%20this%3F%26nbsp%3B%20Any%20way%2C%20will%20see%20in%20Part%203%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3CP%3ECroos.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Senior Member

If you missed the first part it can be found here: 
Building Microservices with Azure Kubernetes Service and Azure DevOps - Part 1

 

After going through part 1 the preparatory steps are in place, and you should be ready to move along with creating a k8s cluster and doing some initial configuring with regards to permissions.

Creating the AKS cluster

The first step for using the Azure CLI is logging in:

az login

AZ_CLI_01.png

Figure 26 az login

 

If you have multiple subscriptions in Azure you might need to use

az account list
az account set --subscription xyz

to make sure you're working on the right one. (Verify the value of the isDefault attribute to see which one the default is.)

 

A resource group to contain the AKS instance is also needed. Technically it doesn't matter which location you deploy the resource group to, but the suggestion is going with a location that is supported for AKS clusters and stick with it throughout the setup.

az group create --name aksdotnetcoder --location northeurope

Next comes creation of the AKS cluster:

 

az aks create --name aksdotnet --resource-group aksdotnetcoder --node-count 1 --generate-ssh-keys --enable-addons http_application_routing -–aad-server-app-id x –-aad-server-app-secret x –-aad-client-app-id x -–aad-tenant-id x
--kubernetes-version 1.x.y --node-vm-size Standard_DS1_v2

 

AZ_CLI_02.png

Figure 27 az aks create

Note: Some of the documentation articles online will include -–enable-rbac as an argument. This has been deprecated, and by default all AKS clusters created with Azure CLI will have RBAC enabled unless you specifically disable it by using the inverse parameter –-disable-rbac.

 

A specific version of Kubernetes is provided in the parameter list here even though that seems to be a low-level detail when dealing with a managed service. Kubernetes is a fast-moving target and sometimes it will be necessary to be on specific versions for specific features and/or compatibility reasons. 1.12.6 is the newest version as of writing this.

 

To get a list of versions run the following command:


az aks get-versions --location "location"

If this parameter is omitted a default version will be chosen, but it is not guaranteed to be the latest version. Since AKS is a managed service there may also be delays between new releases by the Kubernetes team and the time it becomes available in Azure.

 

Existing clusters can be upgraded to a newer version with the click of a button in the Azure Portal or through the Azure CLI:

az aks upgrade --kubernetes-version –name foo --resource-group bar

To keep costs down for a test environment only one node is used, but in production one should ramp up to at least 3 for high availability and scale. The VM size is specified to be of the DS1_v2 type. (This is also the default if you omit the parameter.) It is possible to choose lower performing SKUs, but the performance takes a severe hit which will be noticed when pulling and deployment images later in this guide, so it is not advised to do so. For production use you should have a closer look at the available VM SKUs to make a choice as to which one you want to use. (Note that the availability might vary between regions.)

 

This brings out another value-adding feature of AKS. In a Kubernetes cluster you have management nodes and worker nodes. Just like one would need more than one worker to distribute the load, one needs multiple managers to have high availability. AKS takes care of the management, but not only does the service abstract away the management nodes - you don't pay for them either. You pay for the nodes, and that's it. (Disclaimer: the author cannot guarantee the current model will be in effect for perpetuity.)

 

The creation of the cluster should take 10-15 minutes.

 

To make sure that things are in a good state verify the cluster is working before proceeding. Run the following command to retrieve the correct files for the Kubernetes tools to work:

 

az aks get-credentials --resource-group aksdotnetcoder --name aksdotnet --admin

Run kubectl get nodes, which should look similar to this:

kubectl_01.png

Figure 28 kubectl get nodes

 

YAML – The Configuration Language of Kubernetes

The subsequent sections will make heavy use of Yet Another Markup Language (YAML) for configuring k8s. XML used to be a commonly used format for configuration files, and JSON has become more frequent in the past couple of years. Kubernetes uses YAML instead for most common configurations. (Both options are demonstrated in this guide.)

 

YAML is not a format specific for Kubernetes, but if you aren’t familiar, it is important to understand that indentation matters. 

Setting: foo
Value: bar

Is entirely different from

Setting: foo
  Value: bar

You should use spaces for this indentation; not tabs. You might get informative error messages, and in Visual Studio Code there are plugins that can provide hints, but if you get errors even though you copied and pasted the snippets here check that there haven’t been some auto-formatting reorganizing things.

 

Enabling RBAC for users

The -–admin parameter gave us admin access, but it hasn’t been applied permanently for RBAC for work. To do so create a file called user-rbac.yaml and paste in the following content:

 

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: aksdotnet-cluster-admins
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: user@contoso.com

Replace user@contoso.com with your user name.

 

This file needs to be applied by running kubectl create -f user-rbac.yaml:

kubectl_02.png

Figure 29 kubectl create User RBAC

In practice, you want to apply this on a group level . To do so replace the last two lines with the following (with the objectId for the group):

kind: Group
name: "guid"

 

Enabling RBAC for the Kubernetes Dashboard

These steps make sure you can use the kubectl command line options, but there is also a web-based dashboard one can use for managing an AKS cluster. However, this involves a service account which we have not assigned permissions to yet.

 

To assign these permissions create a file called dashboard-admin.yaml with the following contents:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
labels:
   k8s-app: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kube-system

Apply with

kubectl create -f dashboard-admin.yaml

You can now verify that it is possible to open the Kubernetes dashboard by running

az aks browse --resource-group aksdotnetcoder --name aksdotnet

kubectl_03.png

Figure 30 az aks browse

This will launch a browser with the graphical representation of your cluster:

kubedash_01.png

Figure 31 Kubernetes Dashboard

 

Kubectl also allows for connecting to the dashboard (kubectl proxy) but by using the Azure CLI everything is automatically piggybacked onto the current authenticated Azure session. Notice that the address is 127.0.0.1 even though it isn't local. That's just some proxy tricks where the traffic is tunneled through to Azure.

 

It could be argued that enabling the dashboard opens another attack vector and that it would be preferable to stick to kubectl. There are valid arguments for this school of thought, and it’s also true that certain actions can only be carried out through kubectl. It is however also often faster to get an overview from a web browser, and when learning Kubernetes, it is very helpful to have a graphical representation.

 

RBAC for Helm and installation of the binaries into the cluster

It was mentioned previously that Helm is a sort of package manager for Kubernetes. This applies to both the software packages you build yourself, and those supplied by other parties. The RBAC model we have in place requires that we specifically need to enable support for Helm to work properly. This can be done with the following yaml:

apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
  name: tiller
  namespace: kube-system

 

Apply with kubectl create -f helm-rbac.yaml.

 

It might not be apparent from the definition, but Tiller is the server component, and Helm is the client-side component. (Thus, we use tiller in the naming even though this is not a hardcoded requirement.)

 

Helm needs to be primed as well to be ready for later. Based on having a working cluster as verified in the previous step, helm will automagically work out where to apply its logic. You can have multiple clusters so part of the point in verifying the cluster is ok is to make sure you're connected to the right one.

 

Apply the following:

Helm init –-service-account tiller
Helm repo update

Helm_01.png

Figure 32 helm init and repo update

 

The cluster should now be ready to have images deployed. Which leads to another topic - management of images.

 

Much like one refers to images when building virtual machines, Docker uses the same concept although slightly different on the implementation level. To get running containers inside a Kubernetes cluster you need a repository for these images. The default public repo is Docker Hub, and images stored there will be entirely suited for your AKS cluster. (In fact, third-party images will be acquired from Docker Hub for completion of the guide’s setup.) However, it is not needed to have your images available on the Internet. This requires use of a private repository instead of Docker Hub. In the Azure ecosystem this is delivered by Azure Container Registry (ACR).

 

This setup can be done in the Azure Portal, but for coherency the CLI is used here. It can be placed in the same resource group as the AKS cluster, but since a registry logically speaking is a separate entity a new group will be created for the registry. This means it more visibly lends itself to be re-used across clusters too.

 

Setting up Azure Container Registry (ACR)

Create a resource group:

az group create --name aks-acr-rg --location northeurope

Create an Azure Container Registry with the Basic SKU:

az acr create --resource-group aks-acr-rg --name aksdotnetacr --sku Basic

Since the registry name needs to be globally unique you need to come up with your own moniker for the name parameter. The SKU choice is largely driven by the need for scalability. More details can be found here: https://azure.microsoft.com/en-us/pricing/details/container-registry/

 

While you can now browse the contents of the registry in the portal that does not mean that your cluster can do so. As is indicated by the message upon successful creation of the ACR component we need to create a service principal that will be used by Kubernetes, and we need to give this service principal access to ACR. If you're new to the concept of authentication in Azure AD this statement doesn't explain what a service principal is, but you can think of it as a user account for applications in this context.

 

This is one of those things that are easier to do in the PowerShell ISE:

# Get the id of the service principal configured for AKS
$AKS_RESOURCE_GROUP = "aksdotnetcoder"
$AKS_CLUSTER_NAME = "aksdotnet"
$CLIENT_ID=$(az aks show --resource-group $AKS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query "servicePrincipalProfile.clientId" --output tsv)


# Get the ACR registry resource id
$ACR_NAME = "aksdotnetacr"
$ACR_RESOURCE_GROUP = "aks-acr-rg"
$ACR_ID=$(az acr show --name $ACR_NAME --resource-group $ACR_RESOURCE_GROUP --query "id" --output tsv)


#Create role assignment
az role assignment create --assignee $CLIENT_ID --role Reader --scope $ACR_ID

ACR_01.png

Figure 33 PowerShell ISE

The AKS cluster should now be in a state where it is ready for deployment of services, and the next steps are to create the following recipes for Azure DevOps:

  • How Azure DevOps should build the code.
  • How Azure DevOps should push the resulting artifacts to Azure Container Registry.
  • How Azure DevOps should deploy containers.

 

We're on a roll here, but it feels like a natural point to take a little break before going back to Azure DevOps in the next part.

 

4 Comments
Frequent Visitor

Hi @Andreas Helland,
Great article. I have done the configurations in the 1st part and got the following error in 2nd part in this step 

az group create --name aksdotnetcoder --location northeurope

The subscription '691b6138-2a41-4ba4-b908-cec01314d78c' is disabled and therefore marked as read only. You cannot perform any write actions on this subscription until it is re-enabled.

 

I have only trial subscription. Is it okay or need to pay to continue this process. Is it necessary to pay, What is your recommended subscription for R&D purpose? Is there any possibilities to try it free for test/development?

 

Capture.JPG

Senior Member
Personally I use both a PAYG (Pay as you go) subscription as well as Azure credits from an MSDN subscription for lab work. Which is suitable for most of my needs, but of course MSDN has a cost in itself so unless someone else is picking up that tab it's probably cheaper to pay directly for resources consumed.
 
Azure has a lot of services with a free tier where lab use costs nothing. Unfortunately AKS is not one of those services since it requires allocating non-shared VMs to you. If the purpose is to just spin up the resources in this blog series and deploying a test service we're talking about barely visible amounts on your credit card. With storage, container registry, and VM I believe I rack up roughly 50$ a month when I don't bother with deprovisioning, shutting down, etc.
Frequent Visitor

Thanks a lot @Andreas Helland . Now I got a student subscription and done the above step. Now I got another issue in the following step.

Capture1.JPG

 

I checked the following as well.

 

Capture3.JPG

 

And I also added my yaml files here.

 

Capture4.JPG

 

Can you please give me any suggestions to solve this problem.

 

Thanks,

Croos.

Frequent Visitor

Hi@Andreas Helland ,

I found the solution for the above issue. using the following role binding.

kubectl create rolebinding xxxxxxxxxxxxxxxxxxxxxxxxxxxxxf-admin-binding --clusterrole=admin --user=xxxxxxxxxxxxxxxxxxxxxxx --namespace=kube-system.

 

And I got another issue in the following –-service-account flag.

helm.exe init –-service-account tiller

 Then I tried with out flag, That is also working. Some how I completed all the setups in this part up to PowerShell script. 

 

unfortunately I got this error:

Capture6.JPG

 

DO you have any suggestions on this?  Any way, will see in Part 3 :)

 

Thanks.

Croos.