This example assumes you're going to run the dotnet-environment-viewer sample application. Create a Dockerfile at the root of the application based on the aspnet framework image.
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8
# The following installs and configured Windows Auth for the app (most apps won't need this)
RUN powershell.exe Add-WindowsFeature Web-Windows-Auth
RUN powershell.exe -NoProfile -Command Set-WebConfigurationProperty -filter /system.WebServer/security/authentication/AnonymousAuthentication -name enabled -value false -PSPath 'IIS:\'
RUN powershell.exe -NoProfile -Command Set-WebConfigurationProperty -filter /system.webServer/security/authentication/windowsAuthentication -name enabled -value true -PSPath 'IIS:\'
# The final instruction copies the site you published earlier into the container.
COPY ./ViewEnvironment/ /inetpub/wwwroot
From the directory where the Dockerfile is, build the image and then push it to Harbor.
PS> docker build -t harbor.run.haas.pez.example.com/library/dotnet-environment-viewer:latest .
PS> docker push harbor.run.haas.pez.example.com/library/dotnet-environment-viewer:latest
Now schedule a dotnet environment viewer pod and expose it on a load balancer. kubectl apply the following:
apiVersion: v1
kind: Pod
metadata:
labels:
run: hellowindows
name: hellowindows
spec:
containers:
- name: hellowindows
image: shawnneal/dotnet-environment-viewer
tolerations:
- key: "windows"
value: "2019"
effect: NoExecute
nodeSelector:
kubernetes.io/os: windows
---
apiVersion: v1
kind: Service
metadata:
labels:
run: dotnet-environment-viewer
name: dotnet-environment-viewer-svc
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
run: dotnet-environment-viewer
sessionAffinity: None
type: LoadBalancer
Take note of the load balancer IP and create a DNS entry to point to it that matches one of the SPNs you used when creating the gMSA.
Powershell doesn't natively support these granular ACL settings so we have to use verbose .NET objects.