Hands-On Kubernetes on Windows: Effectively orchestrate Windows container workloads using Kubernetes 1838821562, 9781838821562

Build and deploy scalable cloud applications using Windows containers and Kubernetes Key Features Run, deploy, and orche

1,953 38 14MB

English Pages 592 Year 2020

Report DMCA / Copyright

DOWNLOAD EPUB FILE

Table of contents :
Cover
Title Page
Copyright and Credits
About Packt
Contributors
Table of Contents
Preface
Section 1: Creating and Working with Containers
Chapter 01: Creating Containers
Technical requirements
Linux versus Windows containers
Docker containerization on Linux
Docker containerization on Windows
Key differences between containers on Linux and Windows
Understanding Windows container variants
Process isolation
Hyper-V isolation
Linux containers on Windows
LinuxKit and MobyLinuxVM
LinuxKit LCOW and Hyper-V isolation
Installing Docker Desktop for Windows tooling
Stable and Edge channels
Installation
Verifying the installation
Running process-isolated containers
Running LCOW containers
Building your first container
Preparing a Visual Studio Code workspace
Creating a sample HTML web page
Creating a Dockerfile
Building a Docker image
Running Windows containers
Inspecting container logs
Exec into a running container
Summary
Questions
Further reading
Chapter 02: Managing State in Containers
Technical requirements
Mounting local volumes for stateful applications
Volumes and bind mount
Creating and mounting volumes
Removing volumes
Mounting a local container host directory using bind mounts
Using remote/cloud storage for container storage
Installing the Azure CLI and Azure PowerShell module
Creating Azure Files SMB share
Mounting Azure Files SMB share in a container
Running clustered solutions inside containers
Creating a MongoDB ReplicaSet
Writing and reading test data
Summary
Questions
Further reading
Chapter 03: Working with Container Images
Technical requirements
Storing and sharing container images
Pushing an image to the Docker registry
Using a custom local registry
Using cloud container builders
Creating a GitHub repository
Creating a Docker Hub repository with autobuild
Triggering the Docker Hub autobuild
Creating Azure Container Registry
Building a Docker image using Azure Container Registry
Automatic builds for Azure Container Registry
Image tagging and versioning
Using the latest tag
Semantic versioning
Ensuring the integrity of the image supply chain
Signing an image
Enabling DCT for the client
Summary
Questions
Further reading
Section 2: Understanding Kubernetes Fundamentals
Chapter 04: Kubernetes Concepts and Windows Support
Technical requirements
Kubernetes high-level architecture
What is Kubernetes?
Kubernetes master – control plane
kube-apiserver
etcd cluster
kube-scheduler
kube-controller-manager
cloud-controller-manager
Kubernetes nodes – data plane
kubelet
Container runtime
kube-proxy
DNS
Kubernetes objects
Pods
ReplicaSets
Deployments
StatefulSets
DaemonSets
Services
Storage-related objects
The Windows and Kubernetes ecosystem
Kubernetes limitations on Windows
Creating your own development cluster from scratch
minikube
Docker Desktop for Windows
Production cluster deployment strategies
kubeadm
kops
kubespray
AKS Engine
Managed Kubernetes providers
Creating AKS cluster with Windows nodes
Summary
Questions
Further reading
Chapter 05: Kubernetes Networking
Technical requirements
Kubernetes networking principles
L2 network
Overlay network
Other solutions
Services
ClusterIP
NodePort
LoadBalancer
ExternalName
Ingress
Kubernetes CNI network plugins
Understanding the CNI project
CoreOS Flannel
Windows Server networking in Kubernetes
Limitations
Choosing Kubernetes network modes
L2Bridge
L2Tunnel
Overlay
Transparent
Summary
Questions
Further reading
Chapter 06: Interacting with Kubernetes Clusters
Technical requirements
Installing Kubernetes command-line tooling
Accessing Kubernetes clusters
Working with development clusters
Looking at common kubectl commands
Creating resources
Deleting resources
Describing and listing resources
Editing resources
Running an ad hoc Pod
Accessing Pod container logs
Execcing into a Pod container
Copying Pod container files
Port forwarding and proxying traffic
Summary
Questions
Further reading
Section 3: Creating Windows Kubernetes Clusters
Chapter 07: Deploying a Hybrid On-Premises Kubernetes Cluster
Technical requirements
Preparing the Hyper-V environment
Enabling Hyper-V
Creating an internal NAT Hyper-V vSwitch
Creating an external Hyper-V vSwitch
Creating a Kubernetes master node using kubeadm
Creating a VM and installing Ubuntu Server
Creating the VM
Installing Ubuntu Server
Configuring the network
Installing additional packages for integration with Hyper-V
Setting up a passwordless SSH login
Installing and configuring Kubernetes prerequisites
Planning the cluster
Initializing the cluster
Installing the Kubernetes network
Preparing VMs for Windows nodes
Creating the VM
Installing Windows Server 2019
Configuring the network
Installing the SSH server
Installing and configuring Kubernetes prerequisites
Joining Windows nodes using kubeadm
Deploying and inspecting your first application
Summary
Questions
Further reading
Chapter 08: Deploying a Hybrid Azure Kubernetes Service Engine Cluster
Technical requirements
Installing AKS Engine
Creating an Azure resource group and a service principal
Using apimodel and generating an Azure resource manager template
Deploying the cluster
Deploying and inspecting your first application
Basic operations
Connecting to virtual machines
Enabling Azure Log Analytics and Azure Monitor for containers
Summary
Questions
Further reading
Section 4: Orchestrating Windows Containers Using Kubernetes
Chapter 09: Deploying Your First Application
Technical requirements
Imperatively deploying an application
Using Kubernetes manifest files
Scheduling Pods on Windows nodes
Accessing your application
Scaling the application
Summary
Questions
Further reading
Chapter 10: Deploying Microsoft SQL Server 2019 and a ASP.NET MVC Application
Technical requirements
Creating and publishing an ASP.NET MVC application to Docker Hub
Injecting the configuration using environment variables
Configuring logging for Windows containers log monitor
Creating a Dockerfile
Building and pushing the Docker image
Preparing the AKS Engine
Deploying a failover Microsoft SQL Server 2019
Deploying the ASP.NET MVC application
Accessing the application
Scaling the application
Debugging the application
Creating a debug Dockerfile and publishing a debug image
Updating the Kubernetes Deployment
Attaching the Visual Studio remote debugger
Summary
Questions
Further reading
Chapter 11: Configuring Applications to Use Kubernetes Features
Technical requirements
Using namespaces to isolate applications
Creating namespaces
kubectl commands and namespaces
Deleting namespaces
Health monitoring using liveness and readiness probes
Readiness probes
Liveness probes
Startup probes
Specifying resource limits and configuring autoscaling
Resource requests and limits
HPA
Managing application configuration using ConfigMaps and Secrets
Managing persistent data storage on Windows nodes
Configuring rolling updates for Deployments
Role-Based Access Control
Summary
Questions
Further reading
Chapter 12: Development Workflow with Kubernetes
Technical requirements
Using developer tooling with Kubernetes
Visual Studio 2019
Visual Studio Code
Packaging applications using Helm
Installing Helm
Deploying Microsoft SQL Server using Helm
Creating a Helm chart for our Voting application
Debugging a containerized application using Azure Application Insights
Enabling Azure Application Insights
Snapshot debugger
Using Kubernetes Dashboard
Deploying Kubernetes Dashboard
Accessing pod container logs
Executing commands in a pod container
Working on microservices in a team using Azure Dev Spaces
Summary
Questions
Further reading
Chapter 13: Securing Kubernetes Clusters and Applications
Technical requirements
Securing Kubernetes clusters
Using built-in RBAC for authorization
Using an external authentication provider
Bootstrapping the cluster using kubeadm
Disabling public API access
Disabling the public Dashboard
Running containers in nonprivileged mode
Encrypting data at rest
Using network policies
Securing the image supply chain and scan images
Rotating infrastructure credentials and certificates
Enabling audit logging
Integrating AAD with AKS Engine
Securing container runtime in Windows
Deploying secure applications using network policies
Network policy support
Configuring network policy
Kubernetes secrets on Windows machines
Summary
Questions
Further reading
Chapter 14: Monitoring Kubernetes Applications Using Prometheus
Technical requirements
Available monitoring solutions
Prometheus and monitoring Windows nodes
Provisioning observable Windows nodes
Installing WMI Exporter and enabling Metrics Server in Docker
Using extensions for AKS Engine
Deploying Prometheus using a Helm chart
Installing Helm charts
Verifying the Deployment
Windows Performance Counters
Extending a Docker image with the Telegraf service
Deploying an observable version of the voting application
Monitoring .NET applications using prometheus-net
Installing the NuGet package and adding metrics
Deploying the new version of the voting application
Configuring dashboards and alerts in Grafana
Adding visualizations
Configuring alerting
Summary
Questions
Further reading
Chapter 15: Disaster Recovery
Technical requirements
Kubernetes cluster backup strategy
Backing up an etcd cluster
Restoring the etcd cluster backup
Automating backup
Replacing a failed etcd cluster member
Summary
Questions
Further reading
Chapter 16: Production Considerations for Running Kubernetes
Technical requirements
Provisioning clusters reproducibly
Infrastructure as code for clusters
GitOps for application workloads
Kubeadm limitations
Upgrading clusters
OS patching
Configuring a network proxy for the Docker daemon and Kubernetes
Summary
Questions
Further reading
Assessments
Other Books You May Enjoy
Index

Hands-On Kubernetes on Windows: Effectively orchestrate Windows container workloads using Kubernetes
 1838821562, 9781838821562

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
Recommend Papers