Skip to content

Commit 49d993a

Browse files
committed
Updates to feature tour for File I/O
2 parents c8680f2 + e544f53 commit 49d993a

39 files changed

+447
-172
lines changed

.github/workflows/stale.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ jobs:
2323
exempt-pr-labels: 'keep-open'
2424
stale-pr-message: >
2525
This pull request has been inactive for 14 days.
26-
If you are finished with your changes, don't forget to sign off. See the [contributor guide](https://review.docs.microsoft.com/en-us/help/contribute/contribute-how-to-write-pull-request-automation) for instructions.
26+
If you are finished with your changes, don't forget to sign off. See the [contributor guide](https://review.docs.microsoft.com/en-us/help/contribute/contribute-how-to-write-pull-request-automation?branch=main) for instructions.
2727
If this PR is inactive for 14 more days, it will be closed automatically. Thank you!
2828
2929
VS Content Team
3030
3131
[Contact Us](mailto:[email protected])
32-
[Contributor Guide](https://review.docs.microsoft.com/en-us/help/contribute/visualstudio-docs-contribute?branch=master)
32+
[Contributor Guide](https://review.docs.microsoft.com/en-us/help/contribute/visualstudio-docs-contribute?branch=main)
3333
close-pr-message: >
3434
This pull request has been inactive for 28 days. At this time, we are closing the PR.
3535
If you decide to continue working on your change, you can reopen the PR and continue working. Thank you!
3636
3737
VS Content Team
3838
3939
[Contact Us](mailto:[email protected])
40-
[Contributor Guide](https://review.docs.microsoft.com/en-us/help/contribute/visualstudio-docs-contribute?branch=master)
40+
[Contributor Guide](https://review.docs.microsoft.com/en-us/help/contribute/visualstudio-docs-contribute?branch=main)
4141

bridge/articles/bridge-to-kubernetes-aks.md

Lines changed: 53 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ manager: jmartens
66
ms.technology: bridge
77
ms.custom: "contperf-fy22q1"
88
title: Use Bridge to Kubernetes to run and debug locally with Kubernetes with AKS in Azure
9-
ms.date: 08/11/2022
9+
ms.date: 08/15/2022
1010
description: Learn how to use Bridge to Kubernetes to connect your development computer to an AKS Kubernetes cluster
1111
---
1212

@@ -16,7 +16,7 @@ In this tutorial, you'll use a specific AKS sample microservices web app to lear
1616

1717
## Before you begin
1818

19-
This guide uses the [Bike Sharing sample application][bike-sharing-github] to demonstrate connecting your development computer to a Kubernetes cluster running in AKS. If you already have your own application running on a Kubernetes cluster, see [Develop with Kubernetes](bridge-to-kubernetes-vs-code.md). If you are using another cluster, such as MiniKube running locally, see [Use Bridge to Kubernetes with a sample](bridge-to-kubernetes-sample.md).
19+
This guide uses the [Todo App sample application](https://github.com/microsoft/mindaro/tree/master/samples/todo-app) to demonstrate connecting your development computer to a Kubernetes cluster running in AKS. If you already have your own application running on a Kubernetes cluster, see [Develop with Kubernetes](bridge-to-kubernetes-vs-code.md). If you are using another cluster, such as MiniKube running locally, see [Use Bridge to Kubernetes with a sample](bridge-to-kubernetes-sample.md).
2020

2121
### Prerequisites
2222

@@ -43,156 +43,111 @@ az aks create \
4343

4444
## Install the sample application
4545

46-
Install the sample application on your cluster using the provided script. You can run this script on your development computer or using the [Azure Cloud Shell][azure-cloud-shell]. Use the name of your cluster and resource group.
47-
48-
> [!IMPORTANT]
49-
> You must have **Owner** or **Contributor** access to your cluster in order to run the script.
46+
Download the code and install dependencies
5047

5148
```azurecli-interactive
5249
git clone https://github.com/Microsoft/mindaro
53-
cd mindaro/
54-
chmod +x ./bridge-quickstart.sh
55-
./bridge-quickstart.sh -g MyResourceGroup -n MyAKS
50+
cd mindaro/samples/todo-app
51+
npm install stats-api\
5652
```
5753

58-
Navigate to the sample application running your cluster by opening its public URL, which is displayed in the output of the installation script.
59-
60-
```console
61-
$ ./bridge-quickstart.sh -g MyResourceGroup -n MyAKS
62-
Checking directory /home/<user>/mindaro for GIT repo Microsoft/Mindaro
63-
Setting the Kube context
64-
...
65-
To try out the app, open the url:
66-
bikeapp.bikesharingweb.EXTERNAL_IP.nip.io
67-
```
68-
69-
In the above sample, the public URL is `bikeapp.bikesharingweb.EXTERNAL_IP.nip.io`.
70-
71-
## Connect to your cluster and debug a service
54+
## Connect to your cluster and deploy the app
7255

7356
On your development computer, download and configure the Kubernetes CLI to connect to your Kubernetes cluster using [az aks get-credentials][az-aks-get-credentials].
7457

7558
```azurecli
7659
az aks get-credentials --resource-group MyResourceGroup --name MyAKS
60+
kubectl create namespace todo-app
61+
kubectl config set-context --current --namespace=todo-app
62+
kubectl apply -f deployment.yaml --namespace todo-app
7763
```
7864

79-
Open `mindaro/samples/BikeSharingApp/Bikes` from the [Bike Sharing sample application][bike-sharing-github] in Visual Studio Code. Open the Azure Kubernetes Service extension and select the **bikeapp** namespace in the **MyAKS** cluster. Right-click the **bikeapp** node, and choose **Use Namespace**.
65+
## Try out the app
8066

81-
![Select Namespace](media/bridge-to-kubernetes-vs-code/select-namespace.png)
67+
On the same terminal you were using earlier run below command and copy the IP for front end service under the External IP columnd.
8268

83-
Open a terminal window (**Terminal > New Terminal**), and in the terminal window in the **Bikes** folder, use the `npm install` command to install the dependencies for the application.
84-
85-
```console
86-
npm install
69+
```azurecli
70+
kubectl get services
8771
```
8872

89-
Open the Command Palette (**CTRL**+**SHIFT**+**P** or **Cmd**+**Shift**+**P** on a Mac), and run the command **Bridge to Kubernetes: Configure** to start the configuration process.
90-
91-
Choose the **bikes** service.
92-
93-
![Choose Service](media/bridge-to-kubernetes-vs-code/choose-service.png)
94-
95-
All traffic in the Kubernetes cluster is redirected for the bikes service to the version of your application running in your development computer. Bridge to Kubernetes also routes all outbound traffic from the application back to your Kubernetes cluster.
96-
97-
> [!IMPORTANT]
98-
> You can only redirect services that have a single pod.
99-
100-
After you select your service, you are prompted to enter the TCP port for your local application. For this example, enter "3000".
101-
102-
![Connect choose port](media/bridge-to-kubernetes-vs-code/choose-port.png)
73+
To try out the app, open the url:
74+
(your external IP from above command goes here).nip.io
10375

104-
Choose **Launch via NPM** as the launch task.
76+
## Debug stats-api service
10577

106-
![Connect choose launch task](media/bridge-to-kubernetes-vs-code/choose-launch.png)
78+
On the same terminal you were using earlier type below ot open stats-api in vscode.
10779

108-
> [!NOTE]
109-
> You will be prompted to allow the **EndpointManager** to run elevated and modify your hosts file.
80+
```azurecli
81+
code ./stats-api
82+
```
11083

111-
You have the option of running isolated or not isolated. If you run isolated, only your requests are routed to your local process; other developers can use the cluster without being affected. If you don't run isolated, all traffic is redirected to your local process. For more information on this option, see [Using routing capabilities for developing in isolation][btk-overview-routing].
84+
First, place a breakpoint on line 17 of `server.js`.
11285

113-
![Isolation prompt](media/bridge-to-kubernetes-vs-code/btk-isolation-prompt.png)
86+
Then, make sure todo-app namespace in MYAKS cluster is set as default (if it has * next to it). If it is not set as default, right-click the **todo-app** node, and choose **Use Namespace**.
11487

115-
Select the **Debug** icon on the left and select **Launch via NPM with Kubernetes** at the top.
88+
![Screenshot showing the Bridge to Kubernetes Namespace.](media/bridge-to-kubernetes-sample/bridge-to-kubernetes-namespace.png)
11689

117-
![Choose Bridge to Kubernetes](media/bridge-to-kubernetes-vs-code/choose-bridge-to-kubernetes.png)
90+
Next, configure bridge: open the Command Palette (**CTRL**+**SHIFT**+**P** or **Cmd**+**Shift**+**P** on a Mac) and type Bridge to Kubernetes. Select the **Bridge to Kubernetes: Configure** option.
11891

119-
Your development computer is connected when the VS Code status bar turns orange and the Kubernetes extension shows you are connected.
92+
![Screenshot showing the Bridge to Kubernetes Configure command window.](media/bridge-to-kubernetes-sample/bridge-configure.png)
12093

121-
![Development computer connected](media/bridge-to-kubernetes-vs-code/development-computer-connected.png)
94+
You are prompted to configure the service you want to replace, the port to forward from your development computer, and the launch task to use.
12295

123-
> [!NOTE]
124-
> On subsequent launches, you will not be prompted for the service name, port, launch task, or whether to run isolated. These values are saved in `.vscode/tasks.json`. To change these settings later, open the Command Palette (**CTRL**+**SHIFT**+**P** or **Cmd**+**Shift**+**P** on a Mac), and run the command **Bridge to Kubernetes: Configure**.
96+
Choose the `stats-api` service.
12597

126-
Once your development computer is connected, traffic starts redirecting to your development computer for the service you are replacing.
98+
![Screenshot showing the select the service to connect to window.](media/bridge-to-kubernetes-sample/select-service.png)
12799

128-
## Set a break point
100+
> [!IMPORTANT]
101+
> You can only redirect services that have a single pod.
129102
130-
Open [server.js][server-js-breakpoint] and put your cursor somewhere on line 233. Set a breakpoint with **F9** or selecting **Run** then **Toggle Breakpoint**.
103+
After you select your service, you are prompted to enter the TCP port for your local application. For this example, enter 3001.
131104

132-
Navigate to the sample application by opening the public URL. Select **Aurelia Briggs (customer)** as the user, then select a bike to rent. Notice the image for the bike does not load. Return to Visual Studio Code and observe line 233 is highlighted. The breakpoint you set has paused the service at line 233. To resume the service, hit **F5** or select **Run** then **Continue**. Return to your browser and verify you see a placeholder image for the bike.
105+
![Screenshot showing the enter the port number window.](media/bridge-to-kubernetes-sample/enter-port.png)
133106

134-
Remove the breakpoint by putting your cursor on line 233 in `server.js` and hitting **F9**.
107+
Choose **Run Script: dev** as the launch task.
135108

136-
### Update your application
109+
![Screenshot showing the choose the debugger launch task window.](media/bridge-to-kubernetes-sample/launch-task.png)
137110

138-
Edit `server.js` to remove lines 234 and 235:
111+
You have the option of running isolated or not isolated. If you run isolated, only your requests are routed to your local process; other developers can use the cluster without being affected. If you don't run isolated, all traffic is redirected to your local process. For more information on this option, see [Using routing capabilities for developing in isolation](overview-bridge-to-kubernetes.md#using-routing-capabilities-for-developing-in-isolation). For this example, we will proceed with non-isolated. If you chose isolation, task.json will have the prefix you should use to route request to your machine.
139112

140-
```javascript
141-
// Hard code image url *FIX ME*
142-
theBike.imageUrl = "/static/logo.svg";
143-
```
113+
![Screenshot showing the choose isolation option window.](media/bridge-to-kubernetes-sample/isolation.png)
144114

145-
The section should now look like:
115+
> [!NOTE]
116+
> On subsequent launches, you will just click the debug icon without going through this set up and being prompted for the service name, port, launch task, or whether to run isolated. These values are saved in `.vscode/tasks.json`. To change these settings later, open the Command Palette (**CTRL**+**SHIFT**+**P** or **Cmd**+**Shift**+**P** on a Mac), and run the command **Bridge to Kubernetes: Configure**.
146117
147-
```javascript
148-
var theBike = result;
149-
theBike.id = theBike._id;
150-
delete theBike._id;
151-
```
118+
The Bridge to Kubernetes debugging profile has been successfully configured.
152119

153-
Save your changes and press **Ctrl**+**Shift**+**F5** (**⇧⌘F5** on a Mac) or select **Run** then **Restart Debugging**. After you are reconnected, refresh your browser and verify that you no longer see a placeholder image for the bike.
120+
To start debugging, select the Debug icon on the left and select **Run Script: dev with Kubernetes**. Click the start button next to **Run Script: dev with Kubernetes**.
154121

155-
Select **Run** then **Stop Debugging** or press **Shift**+**F5** to stop the debugger.
122+
![Screenshot showing the choose the choose debug launch profile window.](media/bridge-to-kubernetes-sample/debug-profile.png)
156123

157124
> [!NOTE]
158-
> By default, stopping the debugging task also disconnects your development computer from your Kubernetes cluster. You can change this behavior by searching for **Bridge to Kubernetes: Disconnect After Debugging** in the Visual Studio Code settings and removing the check next to **Disconnect automatically when Debugging ends**. After updating this setting, your development computer will remain connected when you stop and start debugging. To disconnect your development computer from your cluster, click on the Bridge to Kubernetes extension on the status bar then choose **Disconnect current session**.
159-
160-
## Additional configuration
161-
162-
Bridge to Kubernetes can handle routing traffic and replicating environment variables without any additional configuration. If you need to locally replicate services from other namespaces or download any files that are mounted to the container in your Kubernetes cluster, such as a ConfigMap file, you can create a `KubernetesLocalProcessConfig.yaml` to download those files to your development computer. For more information, see [Configure Bridge to Kubernetes][kubernetesLocalProcessConfig-yaml].
125+
> You will be prompted to allow the EndpointManager to run elevated and modify your hosts file.
163126
164-
## Using logging and diagnostics
127+
Your development computer is connected when the VS Code status bar turns orange and the Kubernetes extension shows you are connected. Once your development computer is connected, traffic starts redirecting to your development computer for the stats-api you are replacing.
165128

166-
Logging output is written to the **Bridge to Kubernetes** window after your development computer is connected to your Kubernetes cluster.
129+
![Screenshot showing the choose the debugging with Bridge to Kubernetes window.](media/bridge-to-kubernetes-sample/debugging.png)
167130

168-
![Logging output](media/bridge-to-kubernetes-vs-code/output.png)
131+
Navigate to the frontend entry point of your todo-app. Using that external IP you found earlier (your external IP from get services command).nip.io. Note, if you selected isolation mode, you will need to use (your prefix - can be found in task.json).(your external IP from get services command).nip.io.
169132

170-
Click on the **Kubernetes** Status bar and choose **Show connection diagnostics information**. This command prints the current environment variables and DNS entries in the logging output.
133+
Make a request to the stats-api by choosing the **stats** link.
171134

172-
![Output with diagnostics](media/bridge-to-kubernetes-vs-code/output-diagnostics.png)
135+
![Screenshot showing the choose the running web site - choose the status link.](media/bridge-to-kubernetes-sample/stats.png)
173136

174-
Additionally, you can find the diagnostic logs in the `Bridge to Kubernetes` directory in your development computer's TEMP directory. On Windows 10, that's in `%TEMP%\Bridge to Kubernetes`. On a Mac, the TEMP directory can be found by running `echo $TMPDIR` from a terminal window. On Linux, it is `/tmp/Bridge to Kubernetes`.
137+
Notice the traffic that initially started in your cluster was redirected to your locally running version (outside of the cluster) where the breakpoint was triggered.
175138

176-
## Running in isolation mode
139+
Press play and let the request continue complete transparently.
177140

178-
With Bridge to Kubernetes, you can also set up an isolated version the services you're working on, meaning that others who are using the cluster won't be affected by your changes. This isolation mode is accomplished by routing your requests to your copy of each affected service, but routing all other traffic normally. More explanation on how this is done can be found at [How Bridge to Kubernetes Works][btk-overview-routing].
141+
## Clean up
179142

180-
## Remove the sample application from your cluster
143+
When you stop the debugger all changes to the cluster are reverted. Note, if you were running with isolation on, the routing manager pod will be left there to expedite the start of the debugger the next time around.
181144

182-
Use the provided script to remove the sample application from your cluster.
145+
You can leave your AKS cluster on for future debugging or you can delete it with below command.
183146

184147
```azurecli-interactive
185-
./bridge-quickstart.sh -c -g MyResourceGroup -n MyAKS
148+
az aks delete --name MyAKS --resource-group MyResourceGroup
186149
```
187150

188-
## Troubleshooting
189-
190-
If you get this error when activating the Bridge to Kubernetes extension:
191-
192-
"Failed to update dependencies: maximum number of retries exceeded"
193-
194-
First, retry the activation using the button. If it repeatedly does not succeed, see [https://github.com/microsoft/mindaro/issues/32](https://github.com/microsoft/mindaro/issues/32).
195-
196151
## Next steps
197152

198153
Learn more about Bridge to Kubernetes at [How Bridge to Kubernetes works][btk-how-it-works].
Loading

0 commit comments

Comments
 (0)