Skip to content

Commit 03d70f8

Browse files
committed
Swap out aks voting app with aks store demo
1 parent e396ab5 commit 03d70f8

File tree

1 file changed

+26
-234
lines changed

1 file changed

+26
-234
lines changed

articles/aks/limit-egress-traffic.md

Lines changed: 26 additions & 234 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ You'll define the outbound type to use the UDR that already exists on the subnet
227227
>
228228
> You can add the AKS feature for [**API server authorized IP ranges**](api-server-authorized-ip-ranges.md) to limit API server access to only the firewall's public endpoint. The authorized IP ranges feature is denoted in the diagram as optional. When enabling the authorized IP range feature to limit API server access, your developer tools must use a jumpbox from the firewall's virtual network, or you must add all developer endpoints to the authorized IP range.
229229
230-
### Create an AKS cluster with system-assigned identities
230+
### [Create an AKS cluster with system-assigned identities](#tab/aks-with-system-assigned-identities)
231231

232232
> [!NOTE]
233233
> AKS will create a system-assigned kubelet identity in the node resource group if you don't [specify your own kubelet managed identity][Use a pre-created kubelet managed identity].
@@ -245,14 +245,16 @@ az aks create -g $RG -n $AKSNAME -l $LOC \
245245
--api-server-authorized-ip-ranges $FWPUBLIC_IP
246246
```
247247

248-
### Create user-assigned identities
248+
### [Create an AKS cluster with user-assigned identities](#tab/aks-with-user-assigned-identities)
249249

250-
If you don't have user-assigned identities, follow the steps in this section. If you already have user-assigned identities, skip to [Create an AKS cluster with user-assigned identities](#create-an-aks-cluster-with-user-assigned-identities).
250+
#### Create user-assigned identities
251+
252+
If you don't have user-assigned identities, follow the steps in this section. If you already have user-assigned identities, skip to [Create an AKS cluster with user-assigned identities](#create-an-aks-cluster-with-your-existing-identities).
251253

252254
1. Create a managed identity using the [`az identity create`][az-identity-create] command.
253255

254256
```azurecli-interactive
255-
az identity create --name myIdentity --resource-group myResourceGroup
257+
az identity create --name myIdentity --resource-group $RG
256258
```
257259
258260
The output should resemble the following example output:
@@ -261,11 +263,11 @@ If you don't have user-assigned identities, follow the steps in this section. If
261263
{
262264
"clientId": "<client-id>",
263265
"clientSecretUrl": "<clientSecretUrl>",
264-
"id": "/subscriptions/<subscriptionid>/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity",
265-
"location": "westus2",
266+
"id": "/subscriptions/<subscriptionid>/resourcegroups/aks-egress-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity",
267+
"location": "eastus",
266268
"name": "myIdentity",
267269
"principalId": "<principal-id>",
268-
"resourceGroup": "myResourceGroup",
270+
"resourceGroup": "aks-egress-rg",
269271
"tags": {},
270272
"tenantId": "<tenant-id>",
271273
"type": "Microsoft.ManagedIdentity/userAssignedIdentities"
@@ -275,7 +277,7 @@ If you don't have user-assigned identities, follow the steps in this section. If
275277
2. Create a kubelet managed identity using the [`az identity create`][az-identity-create] command.
276278
277279
```azurecli
278-
az identity create --name myKubeletIdentity --resource-group myResourceGroup
280+
az identity create --name myKubeletIdentity --resource-group $RG
279281
```
280282

281283
The output should resemble the following example output:
@@ -284,11 +286,11 @@ If you don't have user-assigned identities, follow the steps in this section. If
284286
{
285287
"clientId": "<client-id>",
286288
"clientSecretUrl": "<clientSecretUrl>",
287-
"id": "/subscriptions/<subscriptionid>/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myKubeletIdentity",
289+
"id": "/subscriptions/<subscriptionid>/resourcegroups/aks-egress-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myKubeletIdentity",
288290
"location": "westus2",
289291
"name": "myKubeletIdentity",
290292
"principalId": "<principal-id>",
291-
"resourceGroup": "myResourceGroup",
293+
"resourceGroup": "aks-egress-rg",
292294
"tags": {},
293295
"tenantId": "<tenant-id>",
294296
"type": "Microsoft.ManagedIdentity/userAssignedIdentities"
@@ -298,7 +300,7 @@ If you don't have user-assigned identities, follow the steps in this section. If
298300
> [!NOTE]
299301
> If you create your own VNet and route table where the resources are outside of the worker node resource group, the CLI will add the role assignment automatically. If you're using an ARM template or other method, you need to use the Principal ID of the cluster managed identity to perform a [role assignment][add role to identity].
300302
301-
### Create an AKS cluster with user-assigned identities
303+
#### Create an AKS cluster with your existing identities
302304

303305
Create an AKS cluster with your existing identities in the subnet using the [`az aks create`][az-aks-create] command, provide the resource ID of the managed identity for the control plane by including the `assign-kubelet-identity` argument.
304306

@@ -342,225 +344,12 @@ You can now start exposing services and deploying applications to this cluster.
342344
343345
![Public Service DNAT](media/limit-egress-traffic/aks-create-svc.png)
344346
345-
1. Copy the following YAML and save it as a file named `example.yaml`.
346-
347-
```yaml
348-
# voting-storage-deployment.yaml
349-
apiVersion: apps/v1
350-
kind: Deployment
351-
metadata:
352-
name: voting-storage
353-
spec:
354-
replicas: 10
355-
selector:
356-
matchLabels:
357-
app: voting-storage
358-
template:
359-
metadata:
360-
labels:
361-
app: voting-storage
362-
spec:
363-
containers:
364-
- name: voting-storage
365-
image: mcr.microsoft.com/aks/samples/voting/storage:2.0
366-
args: ["--ignore-db-dir=lost+found"]
367-
resources:
368-
requests:
369-
cpu: 100m
370-
memory: 128Mi
371-
limits:
372-
cpu: 250m
373-
memory: 256Mi
374-
ports:
375-
- containerPort: 3306
376-
name: mysql
377-
volumeMounts:
378-
- name: mysql-persistent-storage
379-
mountPath: /var/lib/mysql
380-
env:
381-
- name: MYSQL_ROOT_PASSWORD
382-
valueFrom:
383-
secretKeyRef:
384-
name: voting-storage-secret
385-
key: MYSQL_ROOT_PASSWORD
386-
- name: MYSQL_USER
387-
valueFrom:
388-
secretKeyRef:
389-
name: voting-storage-secret
390-
key: MYSQL_USER
391-
- name: MYSQL_PASSWORD
392-
valueFrom:
393-
secretKeyRef:
394-
name: voting-storage-secret
395-
key: MYSQL_PASSWORD
396-
- name: MYSQL_DATABASE
397-
valueFrom:
398-
secretKeyRef:
399-
name: voting-storage-secret
400-
key: MYSQL_DATABASE
401-
volumes:
402-
- name: mysql-persistent-storage
403-
persistentVolumeClaim:
404-
claimName: mysql-pv-claim
405-
---
406-
# voting-storage-secret.yaml
407-
apiVersion: v1
408-
kind: Secret
409-
metadata:
410-
name: voting-storage-secret
411-
type: Opaque
412-
data:
413-
MYSQL_USER: ZGJ1c2Vy
414-
MYSQL_PASSWORD: UGFzc3dvcmQxMg==
415-
MYSQL_DATABASE: YXp1cmV2b3Rl
416-
MYSQL_ROOT_PASSWORD: UGFzc3dvcmQxMg==
417-
---
418-
# voting-storage-pv-claim.yaml
419-
apiVersion: v1
420-
kind: PersistentVolumeClaim
421-
metadata:
422-
name: mysql-pv-claim
423-
spec:
424-
accessModes:
425-
- ReadWriteOnce
426-
resources:
427-
requests:
428-
storage: 1Gi
429-
---
430-
# voting-storage-service.yaml
431-
apiVersion: v1
432-
kind: Service
433-
metadata:
434-
name: voting-storage
435-
labels:
436-
app: voting-storage
437-
spec:
438-
ports:
439-
- port: 3306
440-
name: mysql
441-
selector:
442-
app: voting-storage
443-
---
444-
# voting-app-deployment.yaml
445-
apiVersion: apps/v1
446-
kind: Deployment
447-
metadata:
448-
name: voting-app
449-
spec:
450-
replicas: 1
451-
selector:
452-
matchLabels:
453-
app: voting-app
454-
template:
455-
metadata:
456-
labels:
457-
app: voting-app
458-
spec:
459-
containers:
460-
- name: voting-app
461-
image: mcr.microsoft.com/aks/samples/voting/app:2.0
462-
imagePullPolicy: Always
463-
ports:
464-
- containerPort: 8080
465-
env:
466-
- name: MYSQL_HOST
467-
value: "voting-storage"
468-
- name: MYSQL_USER
469-
valueFrom:
470-
secretKeyRef:
471-
name: voting-storage-secret
472-
key: MYSQL_USER
473-
- name: MYSQL_PASSWORD
474-
valueFrom:
475-
secretKeyRef:
476-
name: voting-storage-secret
477-
key: MYSQL_PASSWORD
478-
- name: MYSQL_DATABASE
479-
valueFrom:
480-
secretKeyRef:
481-
name: voting-storage-secret
482-
key: MYSQL_DATABASE
483-
- name: ANALYTICS_HOST
484-
value: "voting-analytics"
485-
---
486-
# voting-app-service.yaml
487-
apiVersion: v1
488-
kind: Service
489-
metadata:
490-
name: voting-app
491-
labels:
492-
app: voting-app
493-
spec:
494-
type: LoadBalancer
495-
ports:
496-
- port: 80
497-
targetPort: 8080
498-
name: http
499-
selector:
500-
app: voting-app
501-
---
502-
# voting-analytics-deployment.yaml
503-
apiVersion: apps/v1
504-
kind: Deployment
505-
metadata:
506-
name: voting-analytics
507-
spec:
508-
replicas: 1
509-
selector:
510-
matchLabels:
511-
app: voting-analytics
512-
version: "2.0"
513-
template:
514-
metadata:
515-
labels:
516-
app: voting-analytics
517-
version: "2.0"
518-
spec:
519-
containers:
520-
- name: voting-analytics
521-
image: mcr.microsoft.com/aks/samples/voting/analytics:2.0
522-
imagePullPolicy: Always
523-
ports:
524-
- containerPort: 8080
525-
name: http
526-
env:
527-
- name: MYSQL_HOST
528-
value: "voting-storage"
529-
- name: MYSQL_USER
530-
valueFrom:
531-
secretKeyRef:
532-
name: voting-storage-secret
533-
key: MYSQL_USER
534-
- name: MYSQL_PASSWORD
535-
valueFrom:
536-
secretKeyRef:
537-
name: voting-storage-secret
538-
key: MYSQL_PASSWORD
539-
- name: MYSQL_DATABASE
540-
valueFrom:
541-
secretKeyRef:
542-
name: voting-storage-secret
543-
key: MYSQL_DATABASE
544-
---
545-
# voting-analytics-service.yaml
546-
apiVersion: v1
547-
kind: Service
548-
metadata:
549-
name: voting-analytics
550-
labels:
551-
app: voting-analytics
552-
spec:
553-
ports:
554-
- port: 8080
555-
name: http
556-
selector:
557-
app: voting-analytics
558-
```
347+
1. Review the [AKS Store Demo quickstart](https://github.com/Azure-Samples/aks-store-demo/blob/main/aks-store-quickstart.yaml) manifest to see all the resources that will be created.
559348
560349
2. Deploy the service using the `kubectl apply` command.
561350
562351
```bash
563-
kubectl apply -f example.yaml
352+
kubectl apply -f https://raw.githubusercontent.com/Azure-Samples/aks-store-demo/main/aks-store-quickstart.yaml
564353
```
565354
566355
## Add a DNAT rule to Azure Firewall
@@ -580,11 +369,12 @@ To configure inbound connectivity, you need to write a DNAT rule to the Azure Fi
580369
The IP address will be listed in the `EXTERNAL-IP` column, as shown in the following example output:
581370
582371
```bash
583-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
584-
kubernetes ClusterIP 10.41.0.1 <none> 443/TCP 10h
585-
voting-analytics ClusterIP 10.41.88.129 <none> 8080/TCP 9m
586-
voting-app LoadBalancer 10.41.185.82 20.39.18.6 80:32718/TCP 9m
587-
voting-storage ClusterIP 10.41.221.201 <none> 3306/TCP 9m
372+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
373+
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 9m10s
374+
order-service ClusterIP 10.0.104.144 <none> 3000/TCP 11s
375+
product-service ClusterIP 10.0.237.60 <none> 3002/TCP 10s
376+
rabbitmq ClusterIP 10.0.161.128 <none> 5672/TCP,15672/TCP 11s
377+
store-front LoadBalancer 10.0.89.139 20.39.18.6 80:32271/TCP 10s
588378
```
589379
590380
2. Get the service IP using the `kubectl get svc voting-app` command.
@@ -603,11 +393,13 @@ To configure inbound connectivity, you need to write a DNAT rule to the Azure Fi
603393
604394
Navigate to the Azure Firewall frontend IP address in a browser to validate connectivity.
605395
606-
You should see the AKS voting app. In this example, the firewall public IP was `52.253.228.132`.
396+
You should see the AKS store app. In this example, the firewall public IP was `52.253.228.132`.
397+
398+
:::image type="content" source="./media/container-service-kubernetes-tutorials/aks-store-application.png" alt-text="Screenshot showing the Azure Store Front App opened in a local browser." lightbox="./media/container-service-kubernetes-tutorials/aks-store-application.png":::
607399
608-
![Screenshot shows the A K S Voting App with buttons for Cats, Dogs, and Reset, and totals.](media/limit-egress-traffic/aks-vote.png)
400+
On this page, you can view products, add them to your cart, and then place an order.
609401
610-
### Clean up resources
402+
## Clean up resources
611403
612404
To clean up Azure resources, delete the AKS resource group using the [`az group delete`][az-group-delete] command.
613405

0 commit comments

Comments
 (0)