Cloud Computing Exercise 10

Introduc)on
Cloud Compu)ng Exercise 10 Kubernetes using Azure Kubernetes Service (AKS)
This assignment is an online tutorial that will provide you with some hands-on experience deploying an Azure Kubernetes Service (AKS) Cluster using Azure CLI. You will need the same MicrosoE Azure subscripFon using your Outlook account (not your WUSTL account).
The goals of this assignment include:
1. Deploy an AKS container using Azure CLI
2. Run a Sample mulF-container applicaFon with a web front end and a Redis instance in the
Reading Material
You will need to have some basic understanding of AKS before engaging in this exercise. To gain this basic understand, please refer to:
1. hRps://learn.microsoE.com/en-us/azure/aks/intro-kubernetes
2. hRps://learn.microsoE.com/en-us/azure/aks/concepts-clusters-workloads
3. hRps://learn.microsoE.com/en-us/azure/aks/concepts-clusters-workloads#deployments-and-
yaml-manifests
High-Level Steps
This exercise is based on the following online tutorial: hRps://learn.microsoE.com/en- us/azure/aks/learn/quick-kubernetes-deploy-cli
Prerequisites
exercise, you need the following:
Access to a Windows or Mac (desktop or laptop).
Text editor on your computer (example: Notepad on Windows)
Azure account with an acFve subscripFon (Use your free student subscripFon which you previously created with your Outlook email). Note: An Azure account using your WUSTL account will not work (as it will not have the right privileges).
Azure subscripFon ID (use the ID from your exisFng Azure subscripFon created in earlier exercises)
Docker installed on your local machine (Windows or Mac). See previous exercise
Azure CLI version 2.0.29 or higher (preferably the latest version). To find out what version of CLI you are on, you can type the command: az –version. To upgrade Azure CLI to the latest version, type az upgrade. You can either use one installed locally from one of the previous exercises or

use Cloud Shell aEer logging into your Azure account on web browser. For local installaFon, follow the instrucFons to install Azure CLI and make sure to follow the steps for Mac or Windows installaFon depending on your local machine.
Before you Begin
1. Launch Cloud Shell: hRps://shell.azure.com.
2. You may also want to access your Azure subscripFon on web browser. During the exercise, aEer
typing in Azure CLI commands on your computer, you can refresh your browser and see these
resources appear in your account.
3. Verify that you have the Microso+.Opera0onsManagement and Microso+.Opera0onalInsights
providers registered on your subscripFon. These Azure resource providers are required to support Container insights:
a. Type the following commands on Azure CLI:
az provider show -n Microsoft.OperationsManagement -o table az provider show -n Microsoft.OperationalInsights -o table
b. If they are not registered, register them using the following commands:
az provider register –namespace Microsoft.OperationsManagement az provider register –namespace Microsoft.OperationalInsights
4. Access to Kubernetes command-line-client, kubectl. Kubectl is already installed if you use Azure Cloud Shell (see # 1 above), otherwise to install it locally, use the command:
az aks install-cli
AKS Deployment Exercise
1. If you don’t have a resource group by the name myResourceGroup exisFng from one of the previous exercises, create one now, otherwise just use the exisFng one:
az group create –name myResourceGroup –location eastus
2. Create an AKS cluster with one node and enable a system assigned managed idenFty:
az aks create -g myResourceGroup -n myAKSCluster –enable- managed-identity –node-count 1 –enable-addons monitoring — generate-ssh-keys
If you get an error: “Conflict({“error”:{“code”:”MissingSubscrip0onRegistra0on”,”message”:”The subscrip0on is not registered to use namespace ‘microso+.insights’”, follow the link: hRps://jd- bots.com/2021/08/04/fixed-missingsubscripFonregistraFon-the-subscripFon-is-not-registered- to-use-namespace-microsoE- cogniFveservices/#:~:text=To%20fix%20this%2C%20open%20Azure%20Portal%20and%20go,few %20seconds%20for%20the%20service%20to%20get%20registered. to solve this problem.
3. Configure Kubernetes command-line-client, kubectl, co connect to your Kubernetes cluster:
az aks get-credentials –resource-group myResourceGroup –name myAKSCluster
4. Verify connecFon to your cluster:
kubectl get nodes
Make sure the Status column indicates Ready state.
5. Deploy the applicaFon:
a. Create a manifest file, that defines cluster’s desired state such as which container images to run. The following manifest includes 2 Kubernetes deployments: i) The sample Azure

Vote Python ApplicaFons, ii) A Redis Instance. Create a file names azure-vote.yaml and copy in the following manifest:
apiVersion: apps/v1 kind: Deployment metadata:
name: azure-vote-back spec:
replicas: 1 selector:
matchLabels:
app: azure-vote-back
template: metadata:
app: azure-vote-back
spec: nodeSelector:
“kubernetes.io/os”: linux containers:
– name: azure-vote-back
image: mcr.microsoE.com/oss/bitnami/redis:6.0.8 env:
– name: ALLOW_EMPTY_PASSWORD
value: “yes” resources:
cpu: 100m memory: 128Mi
cpu: 250m memory: 256Mi
– containerPort: 6379
name: redis —
apiVersion: v1 kind: Service metadata:
name: azure-vote-back spec:
– port: 6379 selector:
app: azure-vote-back —
apiVersion: apps/v1

程序代写 CS代考 加微信: cstutorcs
kind: Deployment metadata:
name: azure-vote-front spec:
replicas: 1 selector:
matchLabels:
app: azure-vote-front
template: metadata:
app: azure-vote-front
spec: nodeSelector:
“kubernetes.io/os”: linux containers:
– name: azure-vote-front
image: mcr.microsoE.com/azuredocs/azure-vote-front:v1 resources:
cpu: 100m memory: 128Mi
cpu: 250m memory: 256Mi
– containerPort: 80 env:
– name: REDIS
value: “azure-vote-back” —
apiVersion: v1 kind: Service metadata:
name: azure-vote-front spec:
type: LoadBalancer ports:
– port: 80
app: azure-vote-front
You may want to create the file locally using a text editor and upload it using Cloud Shell. b. Deploy the applicaFon using Kubernetes command-line:
kubectl apply -f azure-vote.yaml
6. Test the applicaFon. When the applicaFon run, a Kubernetes service exposes he applicaFon front end to the internet, which can take a few minutes to complete.

a. Monitor progress of Kubernetes service:
kubectl get service azure-vote-front –watch
The External-IP column will iniFally show as Pending
b. Once the External-IP address changes to an actual IP address, use to stop the kubectl process.
c. Open a web browser and type in the IP address from step 6b above to see the Azure Vote ApplicaFon:
7. STOP! See secFon Ftled: What to Turn-in.
8. Once your TA has verified your app and you have received credit for this assignment, you may
proceed to destroy the resources created in this exercise. See secFon Ftled: Clean up Resources to proceed with cleaning up.
Other Suggested Learning
In this exercise, you deployed a Kubernetes cluster and deployed a simple mulF-container applicaFon to it. To learn more about AKS and walk through a complete code-to-deployment example, conFnue to the Kubernetes cluster tutorials in the following order:
1. Prepare an applicaFon for AKS
2. Push images to, then deploy and use ACR
3. Deploy AKS cluster

程序代写 CS代考 加QQ: 749389476
4. Deploy and Run applicaFon in AKS
5. Scale applicaFons in AKS
6. Update an applicaFon in AKS
7. Upgrade Kubernetes in AKS

What to Turn-In
Email your External-IP address from step 6b to your TA. Your TA will verify compleFon of your assignment by accessing your app through the web browser. Your TA, having access to your Azure subscripFon, will also verify allocaFon of your resources in Azure. Once you have received your grade, you can then go back to step 8 above and delete your Azure resources which you had allocated for this assignment.
Clean up Resources:
If you are no longer in need of the resources, you can delete the resources you created in this exercise:
az group delete –name myResourceGroup –yes –no-wait
References:
1. hRps://learn.microsoE.com/en-us/azure/aks/learn/quick-kubernetes-deploy-cli 2. hRps://learn.microsoE.com/en-us/azure/aks/concepts-clusters-workloads

Code Help, Add WeChat: cstutorcs