From 64c13d170dc1a2c50a251cafe76670fc651e631f Mon Sep 17 00:00:00 2001 From: Kavitha Govindarajulu Date: Mon, 23 Jan 2023 13:47:16 -0500 Subject: [PATCH 1/2] Fix in yaml file for latest version --- README.md | 16 +++++++++++++++- aks.yaml | 11 ++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 680ffd3..afb9f5b 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ You will need the following things installed on your system to walk through thes - If you are running on Mac or want to use VS Code: - [VSCode for Windows, Mac, or Linux](https://code.visualstudio.com/download) or other text editor (Vim, Sublime, etc...) - [C# for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp) -- [.NET Core 6.0 SDK](https://www.microsoft.com/net/download/all) for running our ASP.NET Core projects +- [.NET Core 6.0 SDK or 7.0](https://www.microsoft.com/net/download/all) for running our ASP.NET Core projects ## Creating an ASP.NET Core Web API @@ -83,6 +83,11 @@ The file itself will only have the code sections that you need to type, in betwe ```dockerfile FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env ``` +if you are using .NET 7 instead of 6, use below + +```dockerfile +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env +``` Next we set the working directory and `EXPOSE` port 5000. This is where we will be building the app: @@ -117,7 +122,16 @@ COPY --from=build-env /app/out . ENTRYPOINT ["dotnet", "TodoApi.dll"] ``` +If you are using .NET 7 instead of 6 use the below, + +```dockerfile +# Build runtime image. +FROM mcr.microsoft.com/dotnet/aspnet:7.0 +WORKDIR /app +COPY --from=build-env /app/out . +ENTRYPOINT ["dotnet", "TodoApi.dll"] In total the **Dockerfile** will look like: +``` ```dockerfile # syntax=docker/dockerfile:1 diff --git a/aks.yaml b/aks.yaml index b3936de..2ffa67f 100644 --- a/aks.yaml +++ b/aks.yaml @@ -1,9 +1,14 @@ -apiVersion: apps/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: todo + labels: + deploy: todo spec: replicas: 3 + selector: + matchLabels: + app: todo template: metadata: labels: @@ -11,7 +16,7 @@ spec: spec: containers: - name: todo - image: todov1registry.azurecr.io/todov1 + image: "todov1registry.azurecr.io/todov1" ports: - containerPort: 80 resources: @@ -20,7 +25,7 @@ spec: limits: cpu: 500m imagePullSecrets: - - name: todov1secret + - name: todoapisecret --- apiVersion: v1 kind: Service From 1785f09362a4290315f53f4c69e1f93508086f77 Mon Sep 17 00:00:00 2001 From: Kavitha Govindarajulu Date: Mon, 23 Jan 2023 14:32:16 -0500 Subject: [PATCH 2/2] adding command to delete RG --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index afb9f5b..69e0649 100644 --- a/README.md +++ b/README.md @@ -927,4 +927,12 @@ This will give you access to your dashboard as seen below. You can get all the s From here feel free to play around with your cluster search the Kubectl commands (Kubectl --help) to remove pods, add pods, check on health, modify your Yaml. Its just a demo so its ok if you break it. +### Clean up + +Optional: If you like to clean up the Azure resources that have been created in this course, you can delete the resource group using the following command + +```bash +az group delete --name todoapirg +``` + Enjoy!!