Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kdcllc/K8.DotNetCore.Workshop
Kubernates and DotNetCore Workshop demonstrates essentials skills for DotNetCore Developer
https://github.com/kdcllc/K8.DotNetCore.Workshop
asp-net-core aspnet-product aspnetcore azure-storage cluster docker docker-compose dotnetcore3 helm-charts ingress kdcllc kubernetes kubernetes-cluster kubernetes-deployment learning-by-doing workshop workshop-materials
Last synced: 3 months ago
JSON representation
Kubernates and DotNetCore Workshop demonstrates essentials skills for DotNetCore Developer
- Host: GitHub
- URL: https://github.com/kdcllc/K8.DotNetCore.Workshop
- Owner: kdcllc
- License: apache-2.0
- Created: 2019-10-03T02:00:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-20T18:27:59.000Z (over 2 years ago)
- Last Synced: 2024-11-09T03:52:49.288Z (3 months ago)
- Topics: asp-net-core, aspnet-product, aspnetcore, azure-storage, cluster, docker, docker-compose, dotnetcore3, helm-charts, ingress, kdcllc, kubernetes, kubernetes-cluster, kubernetes-deployment, learning-by-doing, workshop, workshop-materials
- Language: C#
- Homepage:
- Size: 943 KB
- Stars: 17
- Watchers: 3
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](./docs/img/app-diagram.jpg)- `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
- [Install Hyper-V on Windows 10](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v)
- [Install Docker Desktop on Windows](https://docs.docker.com/docker-for-windows/install/)
- Enable Local Kubernetes Cluster: Docker --> Settings --> Kubernetes
![Windows 10 Kubernetes local cluster](./docs/img/win10-docker-k8s-local-cluster.jpg)- [Install alternative K8 dashboard](https://github.com/kubernetes/dashboard/releases/tag/v1.10.1)
This dashboard doesn't require token authentication, since the cluster is running on the local machine.
```bash
# 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](http://localhost:8001/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/overview?namespace=default)
- [Install `Ngnix` Ingress Controller inside Local Kubernetes Cluster](https://kubernetes.github.io/ingress-nginx/deploy/#docker-for-mac)
This component is required for the labs.
```bash
# 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
```2. [Install the Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest)
3. [Install Visual Studio Code](https://code.visualstudio.com/insiders/)
4. Update Windows 10 Hosts file update to include `C:\Windows\System32\drivers\etc\hosts`
```txt
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](https://k8-frontend-app.local/weatherforecast)
5. [Install `Local Managed Service Identity (MSI) Azure Local Authenticator`](./docs/azure-vault.md)
6. [Create Azure Key Vault](https://docs.microsoft.com/en-us/cli/azure/keyvault?view=azure-cli-latest#az-keyvault-create)
7. [Create Azure Storage Account](./docs/azure-storage.md)
## Labs
![K8 Cluster and Azure Resources](./docs/img/k8-azure-diagram.jpg)1. [Lab: Build Docker Images](./docs/docker.md)
2. [Lab: `Kubectl` commands](./docs/kubectl.md)
3. [Lab: Helm simple release](./docs/helm-simple.md)
4. [Lab: Helm templated release](./docs/helm-templated.md)## References
### Windows Terminal
- [Enable Copy & Paste Keybindings](https://github.com/microsoft/terminal/issues/968#issuecomment-518568762)
### General Ideas
- [LIVENESS PROBES ARE DANGEROUS](https://srcco.de/posts/kubernetes-liveness-probes-are-dangerous.html)
- [Graceful termination in Kubernetes with ASP.NET Core](https://blog.markvincze.com/graceful-termination-in-kubernetes-with-asp-net-core/)
- [Getting external traffic into Kubernetes – ClusterIp, NodePort, LoadBalancer, and Ingress](https://www.ovh.com/blog/getting-external-traffic-into-kubernetes-clusterip-nodeport-loadbalancer-and-ingress/)
- [Kubernetes Ingress scenario](https://codeburst.io/replicate-kubernetes-ingress-locally-with-docker-compose-2872e650af6b)
### AKS specific
- [Deploy a SQL Server container in Kubernetes with Azure Kubernetes Services (AKS)](https://docs.microsoft.com/en-us/sql/linux/tutorial-sql-server-containers-kubernetes?view=sql-server-ver15)
- [Create an ingress controller with a static public IP address in Azure Kubernetes Service (AKS)](https://docs.microsoft.com/en-us/azure/aks/ingress-static-ip)
- [Deploying a Stateful Application on Azure Kubernetes Service (AKS)](https://blog.risingstack.com/deploying-a-stateful-application-on-azure-kubernetes-service-aks/)
- [Use Azure managed identities with Azure Kubernetes Services (AKS)](https://blog.jcorioland.io/archives/2018/09/05/azure-aks-active-directory-managed-identities.html)
- [Azure/aad-pod-identity](https://github.com/Azure/aad-pod-identity)
- [Control access to cluster resources using role-based access control and Azure Active Directory identities in Azure Kubernetes Service](https://docs.microsoft.com/en-us/azure/aks/azure-ad-rbac)
- [Key Vault FlexVolume](https://github.com/Azure/kubernetes-keyvault-flexvol)
- [Manually create and use a volume with Azure Files share in Azure Kubernetes Service (AKS)](https://docs.microsoft.com/en-us/azure/aks/azure-files-volume)
- [How to: Mount an Azure Storage File Share to containers in Azure Kubernetes Services (AKS)](https://zimmergren.net/mount-an-azure-storage-file-share-to-deployments-in-azure-kubernetes-services-aks/)
- [Configure agent data collection for Azure Monitor for containers](https://docs.microsoft.com/en-us/azure/azure-monitor/insights/container-insights-agent-config)
### Ingress LetsEncrypt
- [Service principals with Azure Kubernetes Service (AKS)- Manually create a service principal](https://docs.microsoft.com/en-us/azure/aks/kubernetes-service-principal#manually-create-a-service-principal)
- [Create an ingress controller with a static public IP address in Azure Kubernetes Service (AKS)](https://docs.microsoft.com/en-us/azure/aks/ingress-static-ip)
- [fbeltrao/aks-letsencrypt step thru](https://github.com/fbeltrao/aks-letsencrypt/blob/master/install-nginx-ingress.md)
- [https://dev.to/ianknighton/deploying-a-microservice-on-azure-kubernetes-with-lets-encrypt-4eon](https://dev.to/ianknighton/deploying-a-microservice-on-azure-kubernetes-with-lets-encrypt-4eon)