Using vRA to deploy Azure AKS Clusters and register with Tanzu Mission Control
Tags: vmware, aks, azure, codestream
Published: 2021-05-25 10:05:28

---
title: Using vRA to deploy Azure AKS Clusters and register with Tanzu Mission Control
published: true
date: 2021-05-17 15:40:05 UTC
tags: VMware,AKS,Azure,CodeStream
canonical_url: https://veducate.co.uk/vra-deploy-aks-tmc/?utm_source=rss&utm_medium=rss&utm_campaign=vra-deploy-aks-tmc
---

This walk-through will detail the technical configurations for using vRA Code Stream to deploy [AWS EKS Clusters](https://aws.amazon.com/eks), register them as Kubernetes endpoints in vRA Cloud Assembly and Code Stream, and finally register the newly created cluster in [Tanzu Mission Control](https://veducate.co.uk/vmware-tanzu-mission-control-getting-started/).

This post mirrors my original blog post on [using vRA to deploy AWS EKS clusters](https://veducate.co.uk/vra-deploy-eks-tmc/).

##### Requirement

Tanzu Mission Control has some fantastic capabilities, including the ability to deploy Tanzu Kubernetes Clusters to various platforms (vSphere, AWS, Azure). However today there is no support to provision native Azure AKS clusters, it can however manage most Kubernetes distributions.

Therefore, when I was asked about where VMware could provide such capabilities, my mind turned to the ability to deploy the clusters using vRA Code Stream and provide additional functions on making these AKS clusters usable.

##### High Level Steps

- Create a Code Stream Pipeline
  - Create an Azure AKS Cluster
  - Create AKS cluster as endpoint in both Code Stream and Cloud Assembly
  - Register AKS cluster in Tanzu Mission Control
  - Export the SSH keys for the AKS cluster to the docker host.
    - See [this blog post](https://veducate.co.uk/vra-code-stream-preserve-artifacts/)for this bit!

##### Pre-Requisites

- vRA Cloud access
  - The pipeline can be changed easily for use with vRA on-prem
- Azure Account that can provision AKS clusters
  - And basic knowledge of deploying AKS cluster
  - This is a [good beginners guide](https://vzilla.co.uk/vzilla-blog/getting-started-with-microsoft-azure-kubernetes-service-aks) if you need
  - You will need to [create a Service Principal](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli#sign-in-using-a-service-principal) that the Azure CLI tool can login with
- A Docker host to be used by Code Stream
  - Ability to run the container image: [mcr.microsoft.com/azure-cli](http://mcr.microsoft.com/azure-cli)
- Tanzu Mission Control account that can register new clusters
- [VMware Cloud Console Tokens](https://docs.vmware.com/en/VMware-Cloud-services/services/Using-VMware-Cloud-Services/GUID-E2A3B1C1-E9AD-4B00-A6B6-88D31FCDDF7C.html) for vRA Cloud and Tanzu Mission Control API access
- The configuration files for the pipeline can be [found in this GitHub repository](https://github.com/saintdle/vRA-Deploy-AKS-Clusters)

##### Creating a Code Stream Pipeline to deploy a Azure AKS Cluster and register the endpoints with vRA and Tanzu Mission Control

###### Create the variables to be used

First, we will create several variables in Code Stream, you could change the pipeline tasks to use inputs instead if you wanted.

- Create as regular variable
  - aks-tmc-url
    - This is your Tanzu Mission Control URL
- Create as secret
  - aks-tmc-token
    - VMware Cloud Console token for access to use Tanzu Mission Control
  - aks-vra-token
    - VMware Cloud Console token for access to use vRealize Automation Cloud
  - aks\_app\_id
    - This is from your service principal creation
  - aks\_app\_password
    - This is from your service principal creation
  - aks\_tennant\_id
    - This is your Azure tenant ID where you have registered the service principal

[![vRA AKS TMC - Create Variables](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Create-Variables.jpg?resize=604%2C398&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Create-Variables.jpg?ssl=1)

###### Import the “Deploy AKS Cluster” pipeline

Create (import) the pipeline in Code Stream. ([File here](https://github.com/saintdle/vRA-Deploy-AKS-Clusters/blob/main/Code%20Stream/Deploy%20AKS%20Cluster.yaml)). Set line two to your project name then click import.

[![vRA AKS TMC - Code Stream - Import pipeline](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Import-pipeline.jpg?resize=604%2C460&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Import-pipeline.jpg?ssl=1)Open the pipeline, so that we can now configure the necessary items for your infrastructure.

On the Input tab, change the defaults as necessary. I’ve aimed to make the descriptions as useful as possible.

[![vRA AKS TMC - Code Stream - Input - Set defaults](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Input-Set-defaults.jpg?resize=604%2C447&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Input-Set-defaults.jpg?ssl=1)

On the Workspace tab, select your Docker Host to use.

[![vRA AKS TMC - Code Stream - Workspace - Set Docker Host](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Workspace-Set-Docker-Host.jpg?resize=604%2C263&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Workspace-Set-Docker-Host.jpg?ssl=1)

On the Model tab, select each task and click the validate button, ensure you get a green tick. If there are any errors displayed, resolve them. Usually, it’s the referenced variable names do not match.

To be able to access the SSH keys created for the AKS please follow [this blog post](https://veducate.co.uk/vra-code-stream-preserve-artifacts/)to alter the pipeline.

You can also explore each of the tasks and make any changes you feel necessary. I wrote a [blog post here on extracting files](https://veducate.co.uk/vra-code-stream-preserve-artifacts/) created by a CI Task and email notifications.

[![vRA AKS TMC - Code Stream - Model - Validate Tasks](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Model-Validate-Tasks.jpg?resize=604%2C103&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Model-Validate-Tasks.jpg?ssl=1)

When you are happy, click save on the bottom left and enable the pipeline.

[![vRA AKS TMC - Code Stream - Enable Pipeline](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Enable-Pipeline.jpg?resize=524%2C154&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Enable-Pipeline.jpg?ssl=1)

##### Running the pipeline

Now the pipeline is enabled, you will be able to run the pipeline.

[![vRA AKS TMC - Code Stream - Run Pipeline](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Run-Pipeline.jpg?resize=519%2C183&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Run-Pipeline.jpg?ssl=1)

Provide the details for the inputs.

[![vRA AKS TMC - Code Stream - Run Pipeline - Provide Inputs](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Run-Pipeline-Provide-Inputs.jpg?resize=588%2C1092&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Run-Pipeline-Provide-Inputs.jpg?ssl=1)

Click to view the running execution of the pipeline either on the Executions page, or from the little green dialog box that appears if you ran the pipeline from within the pipeline editing view.

Below you can see the output of the first stage and task running. You can click each stage and task to see the progress and outputs from running the commands. Once the pipeline has completed, you’ll see an output all green and the completed message.

[![vRA AKS TMC - Code Stream - Run Pipeline - Execution](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Run-Pipeline-Execution.jpg?resize=604%2C399&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Run-Pipeline-Execution.jpg?ssl=1)

And finally, you’ll have the following items created and configured.

- Azure AKS Cluster
- Cloud Assembly – External Kubernetes Endpoint
- Code Stream – Kubernetes Endpoint
- Tanzu Mission Control – Kubernetes cluster attached
- Optional: the SSH keys generated for the nodes available on the docker host.

[![vRA AKS TMC - AZ AKS List](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-AZ-AKS-List.jpg?resize=504%2C522&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-AZ-AKS-List.jpg?ssl=1)

[![vRA AKS TMC - Cloud Assembly - Kubernetes Endpoint](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Cloud-Assembly-Kubernetes-Endpoint.jpg?resize=604%2C729&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Cloud-Assembly-Kubernetes-Endpoint.jpg?ssl=1)

[![vRA AKS TMC - Code Stream - Kubernetes Endpoint](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Kubernetes-Endpoint.jpg?resize=604%2C485&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-Code-Stream-Kubernetes-Endpoint.jpg?ssl=1)

[![vRA AKS TMC - TMC - cluster attached](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-TMC-cluster-attached.jpg?resize=604%2C81&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/05/vRA-AKS-TMC-TMC-cluster-attached.jpg?ssl=1)

##### Wrap up

So this blog post is very similar to my previous on for [deploying AWS EKS resources using vRA](https://veducate.co.uk/vra-deploy-eks-tmc/). There are a few changes under the hood to make this method work for AKS, and in a separate blog post I’ve also looked at [how you access the files created](https://veducate.co.uk/vra-code-stream-preserve-artifacts/) from your CI tasks as well.

Hopefully this was helpful.

Regards

[Follow @Saintdle](https://twitter.com/saintdle)<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

[Dean Lewis](https://uk.linkedin.com/in/saintdle?trk=profile-badge)

 

The post [Using vRA to deploy Azure AKS Clusters and register with Tanzu Mission Control](https://veducate.co.uk/vra-deploy-aks-tmc/) appeared first on [vEducate.co.uk](https://veducate.co.uk).