Deploying a Web App to Azure Kubernetes Service Using GitHub Copilot for Azure
Deploying a web app to Azure Kubernetes Service (AKS) can be simplified by leveraging tools like GitHub Copilot for Azure in Visual Studio Code (VS Code). Here’s a step-by-step guide on how you can create an AKS cluster and deploy a sample store app with the help of GitHub Copilot for Azure.
Getting Started: Setting Up GitHub Copilot for Azure in VS Code
To begin, install the GitHub Copilot for Azure extension in VS Code. This extension enhances your coding experience by providing contextual assistance for Azure-related tasks. Start by opening the GitHub Copilot Chat window and entering commands directly, prefacing them with “Azure.”
Step 1: Searching for a Sample App to Deploy to AKS
Let’s start by searching for a sample store web app to deploy. Simply type a prompt in the GitHub Copilot Chat window, such as:
"Can you find a sample store web app to deploy to AKS?"
GitHub Copilot for Azure will present options, including a Store Demo App for AKS, complete with key features and setup instructions. You can use the Azure Developer CLI (azd) to get the code cloned to your machine.
Step 2: Cloning the Sample App with Azure Developer CLI
Use the following command in the terminal to clone the sample app:
azd init --template <sample-store-app-url>
Once you’ve cloned the app, give it an environment name and open it in a separate instance of VS Code. You’ll find all necessary files, including the manifest, ready for deployment.
Step 3: Creating an AKS Cluster
With the sample app ready, the next step is to set up an AKS cluster. In the GitHub Copilot Chat window, type:
"Help me create an AKS cluster."
GitHub Copilot provides an interactive Create Cluster button. This shortcut, powered by the Azure Kubernetes Services (AKS) extension in VS Code, streamlines the cluster creation process.
Step 4: Configuring the Cluster
Select the Create Cluster button to proceed with the configuration. Here’s what you need to choose:
Recommended by LinkedIn
Once configured, start the cluster creation process, which may take a few minutes to complete.
Step 5: Deploying the App to the AKS Cluster
With the AKS cluster set up, it’s time to deploy the sample app. To get started, type the following prompt in the chat window:
"Deploy my application manifest to an AKS cluster."
GitHub Copilot will provide a Get Started button, which, when selected, prompts you to choose the manifest file and the newly created cluster for deployment. Select the store quickstart manifest file and confirm the deployment.
Step 6: Monitoring and Accessing the Application
After deployment, you can check the status of the app in the Azure portal. Here’s what to look for:
Congratulations! You’ve successfully found a sample app, created an AKS cluster, and deployed your app—all within VS Code.
What Else Can GitHub Copilot for Azure Do?
The GitHub Copilot for Azure extension streamlines a wide array of Azure operations, from cluster management to app deployment, and even configuration assistance for complex workflows. Try it out to enhance your development experience and make cloud operations simpler than ever.
By following these steps, you can harness the power of GitHub Copilot for Azure to quickly set up and deploy applications on AKS, making Kubernetes more accessible within your development environment. Give it a try and explore the full potential of this powerful extension!