Workshop gets an update - JavaScript Services, Docker, Kubernetes and Helm!
If you've been to a conference around .NET in the last year or so, there's likely been workshop available from the .NET team. Jeff Fritz, Jon Galloway, Maria Naggaga, Damian Edwards and/or Daniel Roth and I have all presented in part some of the ConferencePlanner app.
The workshop contains building an application from scratch in .NET Core using Razor Pages, Entity Framework, Web API.
I spent some time over the last week updating the workshop to add options for using the updated JavaScriptServices and Deployment options with Docker, Kubernetes, and Helm.
Adding JavaScript Services
Adding Angular SPA using JavaScript Services
Some great improvements have been made to the JavaScript Services for using Angular and React, integrating each frameworks' CLI directly within the templates for the dotnet new
commands.
Deployment Options
Visual Studio offers great support for deploying ASP.NET applications through the publish dialog; Azure App Service, Local File System and/or you have the option of Git integration. Container development and deployment options have been added to the workshop as well.
Docker
Prerequisites
In this option, the application is separated into three parts
- Frontend : Razor Pages application
- Backend : Web API
- SQL Server Container on Linux
Kubernetes
Prerequisites
- Kubernetes cluster : See Getting Started with AKS on Azure
Publish using Kubernetes deployment file - workshop.yaml
In the /save-points/6-Deployment-docker/ConferencePlanner/kubernetes/ folder is the workshop.yaml deployment file which allows for deployment of the ASP.NET application stack (not SPA Frontend) to a Kubernetes cluster.
kubectl deploy -f workshop.yaml
Helm Chart
Prerequisites
- Kubernetes cluster : See Getting Started with AKS on Azure
- Helm : Installing Helm
Publish using Helm Chart - helm folder
Helm is a package manager for Kubernetes and chart is a collection of files that describe a related set of Kubernetes resources. See more on Helm charts in the docs.
The templates define the resource for the service or deployment and the values.yaml file is used to fill in the template.
templates/frontend-service.yaml
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}-{{ .Values.frontend.name }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
ports:
- port: {{ .Values.frontend.externalPort }}
targetPort: {{ .Values.frontend.internalPort }}
protocol: TCP
name: {{ .Values.frontend.name }}
selector:
app: {{ template "name" . }}
release: {{ .Release.Name }}
status:
loadBalancer: {}
values.yaml (subset)
frontend:
replicaCount: 1
name: frontend
internalPort: 80
externalPort: 80
image: frontend
tag: latest
environment: Production
pullPolicy: IfNotPresent
restart: Always
Running the install
command for helm
fills in the templates using the values.yaml file and deploys the application to the Kubernetes cluster configured in your .kubeconfig
helm install --debug ./workshop
If you want to see the output, use the --dry-run
option.