Skip to content

Kubernates and DotNetCore Workshop demonstrates essentials skills for DotNetCore Developer

License

Notifications You must be signed in to change notification settings

kdcllc/K8.DotNetCore.Workshop

Repository files navigation

Kubernetes DotNetCore Workshop

This workshop will provide with ability to learn the basics of the Kubernetes development from DotNetCore developer perspective.

The solution includes the following projects: Application layout

  • K8.AspNetCore.HealthChecks.csproj - a simple project that demonstrates how to add custom HealthChecks.
  • K8.Extensions.Configuration.csproj - a project that creates a custom Azure Key Vault Secrets retrieval.
  • K8.Extensions.Hosting.csproj - a project that demonstrates how to extend hosting creation for the common K8s projects.
  • K8.FrontEnd.csproj - the AspNetCore Web Api project that demonstrates usage of health and liveliness checks.
  • K8.LongProcess.csproj - the DotNetCore 3.0 Worker Hosted Console App that runs custom K8s CronJobs.

Technologies

  • Docker Containers
  • Kubernetes Cluster
  • Helm deployment
  • Microsoft Azure Managed Identity (MSI)

Pre-requisites

  1. Install Docker and Local Kubernetes Cluster on Windows 10

This dashboard doesn't require token authentication, since the cluster is running on the local machine.

    # install
    kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/alternative/kubernetes-dashboard.yaml

    # launch the dashboard
    kubectl proxy

    # dashboard url 'http://localhost:8001/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/overview?namespace=default'

The UI dashboard is useful for learning and management purposes.

Open Local Kuberbetes Cluster Dashboard

This component is required for the labs.

    # installation
    kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud-generic.yaml

    # validate installation
    kubectl get pods --all-namespaces -l app.kubernetes.io/name=ingress-nginx --watch
  1. Install the Azure CLI

  2. Install Visual Studio Code

  3. Update Windows 10 Hosts file update to include C:\Windows\System32\drivers\etc\hosts

    127.0.0.1 kubernetes.docker.internal k8-frontend-app.local

This hosts entry provides with the following local development Url for the application

https://k8-frontend-app.local/weatherforecast

  1. Install Local Managed Service Identity (MSI) Azure Local Authenticator

  2. Create Azure Key Vault

  3. Create Azure Storage Account

Labs

K8 Cluster and Azure Resources

  1. Lab: Build Docker Images
  2. Lab: Kubectl commands
  3. Lab: Helm simple release
  4. Lab: Helm templated release

References

Windows Terminal

General Ideas

AKS specific

Ingress LetsEncrypt