Skip to content

Commit 85932f9

Browse files
Merge pull request #111179 from zr-msft/ds-byo-qs
[Dev Spaces] added quickstart for existing helm chart
2 parents e72b621 + 537452e commit 85932f9

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
title: "Develop an application with an existing Helm chart on Kubernetes"
3+
services: azure-dev-spaces
4+
ms.date: 04/21/2020
5+
ms.topic: quickstart
6+
description: "This quickstart shows you how to use Azure Dev Spaces and the command line to develop an application with an existing Helm chart on Azure Kubernetes Service"
7+
keywords: "Docker, Kubernetes, Azure, AKS, Azure Kubernetes Service, containers, Helm, service mesh, service mesh routing, kubectl, k8s"
8+
manager: gwallace
9+
---
10+
# Quickstart: Develop an application with an existing Helm chart on Kubernetes - Azure Dev Spaces
11+
In this guide, you will learn how to:
12+
13+
- Set up Azure Dev Spaces with a managed Kubernetes cluster in Azure.
14+
- Run an application with an existing Helm chart in AKS using Azure Dev Spaces on the command line.
15+
16+
## Prerequisites
17+
18+
- An Azure subscription. If you don't have an Azure subscription, you can create a [free account](https://azure.microsoft.com/free).
19+
- [Azure CLI installed](/cli/azure/install-azure-cli?view=azure-cli-latest).
20+
21+
## Create an Azure Kubernetes Service cluster
22+
23+
You need to create an AKS cluster in a [supported region][supported-regions]. The below commands create a resource group called *MyResourceGroup* and an AKS cluster called *MyAKS*.
24+
25+
```azurecli
26+
az group create --name MyResourceGroup --location eastus
27+
az aks create -g MyResourceGroup -n MyAKS --location eastus --generate-ssh-keys
28+
```
29+
30+
## Enable Azure Dev Spaces on your AKS cluster
31+
32+
Use the `use-dev-spaces` command to enable Dev Spaces on your AKS cluster and follow the prompts. The below command enables Dev Spaces on the *MyAKS* cluster in the *MyResourceGroup* group and creates a dev space called *dev*.
33+
34+
> [!NOTE]
35+
> The `use-dev-spaces` command will also install the Azure Dev Spaces CLI if its not already installed. You cannot install the Azure Dev Spaces CLI in the Azure Cloud Shell.
36+
37+
```azurecli
38+
az aks use-dev-spaces -g MyResourceGroup -n MyAKS --space dev --yes
39+
```
40+
41+
## Get sample application code
42+
43+
In this article, you use the [Azure Dev Spaces sample application](https://github.com/Azure/dev-spaces) to demonstrate using Azure Dev Spaces.
44+
45+
Clone the application from GitHub and navigate into the *dev-spaces/samples/python/getting-started/webfrontend* directory:
46+
47+
```cmd
48+
git clone https://github.com/Azure/dev-spaces
49+
cd dev-spaces/samples/python/getting-started/webfrontend
50+
```
51+
52+
## Prepare the application
53+
54+
In order to run your application on Azure Dev Spaces, you need a Dockerfile and Helm chart. For some languages, such as [Java][java-quickstart], [.NET core][netcore-quickstart], and [Node.js][nodejs-quickstart], the Azure Dev Spaces client tooling can generate all the assets you need. For many other languages, such as Go, PHP, and Python, the client tooling can generate the Helm chart as long as you can provide a valid Dockerfile. In this case, the sample application has an existing Dockerfile and Helm chart
55+
56+
Generate the configuration for running the application with Azure Dev Spaces with the existing Helm chart and Dockerfile using the `azds prep` command:
57+
58+
```cmd
59+
azds prep --enable-ingress --chart webfrontend/
60+
```
61+
62+
You must run the `prep` command from the *dev-spaces/samples/python/getting-started/webfrontend* directory and specify the location of the Helm chart using `--chart`.
63+
64+
> [!NOTE]
65+
> You may see the warning: *WARNING: Dockerfile could not be generated due to unsupported language.* when running `azds prep`. The `azds prep` command attempts to generate [a Dockerfile and Helm chart](how-dev-spaces-works-prep.md#prepare-your-code) for your project, but will not overwrite any existing Dockerfiles or Helm charts.
66+
67+
## Build and run code in Kubernetes
68+
69+
Build and run your code in AKS using the `azds up` command:
70+
71+
```cmd
72+
$ azds up
73+
Using dev space 'dev' with target 'MyAKS'
74+
Synchronizing files...14s
75+
Installing Helm chart...2s
76+
Waiting for container image build...3s
77+
Building container image...
78+
Step 1/7 : FROM python:3
79+
Step 2/7 : WORKDIR /python/webfrontend
80+
Step 3/7 : RUN pip install flask
81+
Step 4/7 : COPY webfrontend.py webfrontend.py
82+
Step 5/7 : COPY public/ public/
83+
Step 6/7 : EXPOSE 80
84+
Step 7/7 : CMD ["python", "./webfrontend.py"]
85+
Built container image in 45s
86+
Waiting for container...25s
87+
Service 'azds-543eae-dev-webfrontend' port 'http' is available at http://dev.service.1234567890abcdef1234.eus.azds.io/
88+
Service 'azds-543eae-dev-webfrontend' port 80 (http) is available via port forwarding at http://localhost:52382
89+
Press Ctrl+C to detach
90+
...
91+
```
92+
93+
You can see the service running by opening the public URL, which is displayed in the output from the `azds up` command. In this example, the public URL is *http://dev.service.1234567890abcdef1234.eus.azds.io/*.
94+
95+
> [!NOTE]
96+
> When you navigate to your service while running `azds up`, the HTTP request traces are also displayed in the output of the `azds up` command. These traces can help you troubleshoot and debug your service. You can disable these traces using `--disable-http-traces` when running `azds up`.
97+
98+
If you stop the `azds up` command using *Ctrl+c*, the service will continue to run in AKS, and the public URL will remain available.
99+
100+
## Update code
101+
102+
To deploy an updated version of your service, you can update any file in your project and rerun the `azds up` command. For example:
103+
104+
1. If `azds up` is still running, press *Ctrl+c*.
105+
1. Update [line 13 in `webfrontend.py`](https://github.com/Azure/dev-spaces/blob/master/samples/python/getting-started/webfrontend/webfrontend.py#L13) to:
106+
107+
```javascript
108+
res.send('Hello from webfrontend in Azure');
109+
```
110+
111+
1. Save your changes.
112+
1. Rerun the `azds up` command:
113+
114+
```cmd
115+
$ azds up
116+
Using dev space 'dev' with target 'MyAKS'
117+
Synchronizing files...11s
118+
Installing Helm chart...3s
119+
Waiting for container image build...
120+
...
121+
```
122+
123+
1. Navigate to your running service and observe your changes.
124+
1. Press *Ctrl+c* to stop the `azds up` command.
125+
126+
## Clean up your Azure resources
127+
128+
```azurecli
129+
az group delete --name MyResourceGroup --yes --no-wait
130+
```
131+
132+
## Next steps
133+
134+
Learn how Azure Dev Spaces helps you develop more complex applications across multiple containers, and how you can simplify collaborative development by working with different versions or branches of your code in different spaces.
135+
136+
> [!div class="nextstepaction"]
137+
> [Team development in Azure Dev Spaces][team-quickstart]
138+
139+
[java-quickstart]: quickstart-java.md
140+
[nodejs-quickstart]: quickstart-nodejs.md
141+
[netcore-quickstart]: quickstart-netcore.md
142+
[team-quickstart]: quickstart-team-development.md
143+
[supported-regions]: https://azure.microsoft.com/global-infrastructure/services/?products=kubernetes-service

articles/dev-spaces/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
href: quickstart-netcore-visualstudio.md
2222
- name: Develop using the CLI
2323
href: quickstart-cli.md
24+
- name: Develop using existing Helm chart
25+
href: quickstart-existing-helm-chart.md
2426
- name: Tutorials
2527
items:
2628
- name: Java (VS Code & CLI)

0 commit comments

Comments
 (0)