Mastering DevOps in Kubernetes: Maximize your container workload efficiency with DevOps practices in Kubernetes

Mastering DevOps in Kubernetes: Maximize your container workload efficiency with DevOps practices in Kubernetes

Mastering DevOps in Kubernetes: Maximize your container workload efficiency with DevOps practices in Kubernetes
Автор: Chowdhury Soumiyajit Das
Дата выхода: 2024
Издательство: BPB Publications
Количество страниц: 445
Размер файла: 17,5 МБ
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы

1. DevOps for Kubernetes.............................................................................. 1
Introduction................................................................................................. 1
Structure..................................................................................................... 2
Objectives.................................................................................................... 2
Challenges for the enterprise DevOps.............................................................. 2
Managing multiple environments......................................................................3
Scalability and high availability........................................................................4
Implementation cost......................................................................................5
Traffic management.......................................................................................6
Application upgrades and rollbacks...................................................................6
Securing infrastructure...................................................................................7
Optimization of the delivery pipeline................................................................7
Choice of tools and technology adoption...........................................................8
Kubernetes DevOps...................................................................................... 9
Infrastructure and configuration as code..........................................................9
Upgrading infrastructure.................................................................................10
Updates and rollback........................................................................................10
On-demand infrastructure..............................................................................11
Reliability..........................................................................................................11
Zero downtime deployments............................................................................12
Service mesh.....................................................................................................12
Infrastructure security......................................................................................12
Conclusion........................................................................................................ 13
Key facts.......................................................................................................... 13
Multiple choice questions.................................................................................... 14
Answers.............................................................................................................15
References........................................................................................................ 15
2. Container Management with Docker...................................................................17
Introduction...................................................................................................... 17
Structure.......................................................................................................... 18
Objectives........................................................................................................ 18
Working with Dockerfile...................................................................................... 19
Dockerfile and Docker build context.................................................................20
Running a pre-build image..............................................................................20
Creating own Dockerfile..................................................................................22
Dockerfile instructions.....................................................................................23
Building a multi-container application................................................................ 28
Docker compose.............................................................................................28
Build images from the Docker compose..............................................................31
Creating a WordPress website using Docker compose...........................................33
Container management................................................................................... 35
Docker Swarm............................................................................................... 39
Inspecting Docker Swarm nodes.......................................................................39
Promoting docker nodes..................................................................................40
Managing services in Docker Swarm..................................................................43
Using network in Docker Swarm mode..............................................................45
Deploying stacks to a Swarm...........................................................................47
Conclusion................................................................................................... 52
Points to remember....................................................................................... 52
Multiple choice questions............................................................................... 53
Answers.......................................................................................................55
References................................................................................................... 55
3. Speeding up with Standard Kubernetes Operations..........................................57
Introduction.................................................................................................. 57
Structure...................................................................................................... 57
Objectives.................................................................................................... 58
Kubernetes architecture................................................................................. 58
Kubernetes setup.......................................................................................... 61
Local setup with Minikube...............................................................................61
Create a Kubernetes cluster using Kubeadm...................................................66
Step 1—Create the Kubernetes servers.......................................................66
Step 2—Install kubelet, kubeadm, and kubectl.............................................66
Step 3—Disable Swap.................................................................................67
Step 4—Enable Kernel modules..................................................................67
Step 5—Install container runtime..............................................................67
Step 6—Bootstrap master node..................................................................68
Step 7—Add the worker nodes...................................................................69
Access the Kubernetes dashboard......................................................................... 70
Standard Kubernetes operations........................................................................... 73
Deployment and services.................................................................................74
Labels and selectors..........................................................................................84
Container lifecycle events and hooks...............................................................87
ConfigMaps......................................................................................................89
Init containers...................................................................................................94
Secrets...............................................................................................................98
Autoscaling.....................................................................................................103
Affinity and anti-affinity................................................................................107
Taints and tolerations....................................................................................114
Jobs..................................................................................................................117
Custom resource definitions...........................................................................118
Conclusion.............................................................................................................122
Points to remember...............................................................................................122
Multiple choice questions.....................................................................................123
Answers...........................................................................................................123
References..............................................................................................................124
4. Stateful Workloads in Kubernetes...............................................................125
Introduction...........................................................................................................125
Structure.................................................................................................................125
Objectives...............................................................................................................126
Kubernetes storage................................................................................................126
Persistent Volume in Kubernetes........................................................................127
Configure a Pod to use Persistent Volume.....................................................128
Dynamic volume provisioning in Kubernetes..................................................131
Dynamic NFS provisioning in Kubernetes.......................................................132
Stateful applications..............................................................................................141
Managing stateful applications in Kubernetes..................................................141
StatefulSets best practices.....................................................................................146
Conclusion.............................................................................................................147
Points to remember...............................................................................................148
Multiple choice questions.....................................................................................148
Answers...........................................................................................................149
References..............................................................................................................149
5. Amazon Elastic Kubernetes Service..................................................................151
Introduction...........................................................................................................151
Structure.................................................................................................................151
Objectives...............................................................................................................152
Amazon elastic Kubernetes service....................................................................152
Provisioning EKS cluster......................................................................................154
Install AWS, kubectl, and eksctl CLI.............................................................155
Create the EKS cluster using eksctl................................................................157
Create node groups and IAM OIDC.............................................................158
Amazon EBS..........................................................................................................160
AWS RDS...............................................................................................................168
AWS load balancers and AWS Ingress................................................................173
Classic load balancer......................................................................................173
Network load balancers.................................................................................177
Application load balancer..............................................................................179
Creating EKS cluster using IaC...........................................................................189
terraform version............................................................................................190
Conclusion.............................................................................................................197
Points to remember...............................................................................................197
Multiple Choice Questions..................................................................................198
Answers...........................................................................................................199
References..............................................................................................................199
6. Azure Kubernetes Service............................................................................201
Introduction...........................................................................................................201
Structure.................................................................................................................201
Objectives...............................................................................................................202
Azure Kubernetes Service....................................................................................202
Provisioning an AKS cluster................................................................................203
Azure virtual network...........................................................................................205
AKS storage using Azure disks............................................................................206
AKS storage class and provisioners...............................................................206
AKS managed storage with Azure MYSQL.......................................................217
AKS Ingress using the NGINX Ingress controller............................................222
Active directory integration for AKS clusters...................................................231
Azure AKS virtual nodes......................................................................................235
Provisioning an AKS cluster using Terraform IaC.............................................242
Conclusion.............................................................................................................246
Points to remember...............................................................................................247
Multiple choice questions.....................................................................................247
Answers...........................................................................................................248
References..............................................................................................................248
7. Google Kubernetes Engine ..........................................................................249
Introduction...........................................................................................................249
Structure.................................................................................................................249
Objectives...............................................................................................................250
Google Kubernetes Engine..................................................................................250
Provisioning a GKE cluster..................................................................................251
GKE service load balancer and Ingress controller...............................................254
Load balancer service type.............................................................................254
GKE load balancing with Ingress objects..........................................................255
GKE cluster autoscaling.......................................................................................260
Dynamic storage provisioning in GKE..............................................................261
GKE and Google Cloud SQL...............................................................................265
Binary Authorization in GKE..............................................................................270
Creating GKE cluster using Terraform IaC...........................................................273
Conclusion.............................................................................................................277
Points to remember...............................................................................................278
Multiple choice questions.....................................................................................278
Answers...........................................................................................................279
References..............................................................................................................279
8. Kubernetes Administrator................................................................................281
Introduction...........................................................................................................281
Structure.................................................................................................................281
Objectives...............................................................................................................282
Resource quota......................................................................................................282
Kubernetes networking........................................................................................284
Network policies.............................................................................................286
Node maintenance................................................................................................293
Pod disruption budget..........................................................................................293
Pod topology spread constraints.........................................................................296
High availability....................................................................................................298
etcd backup and restore........................................................................................299
Kubernetes probes.................................................................................................303
Startup probe..................................................................................................303
Liveliness probe...............................................................................................304
Readiness probe..............................................................................................305
Conclusion.............................................................................................................307
Points to remember...............................................................................................307
Multiple choice questions.....................................................................................307
Answers...........................................................................................................308
References..............................................................................................................308
9. Kubernetes Security.....................................................................................309
Introduction...........................................................................................................309
Structure.................................................................................................................309
Objectives...............................................................................................................310
Node restrictions...................................................................................................310
Static analysis with Kubesec.................................................................................312
Security context.....................................................................................................314
Security context for pod.................................................................................314
Security context for container........................................................................316
Pod security admission.........................................................................................318
Role-Based Access Control..................................................................................321
Enable auditing in Kube APIServer....................................................................324
Conclusion.............................................................................................................327
Points to remember...............................................................................................327
Multiple choice questions.....................................................................................328
Answers...........................................................................................................328
References..............................................................................................................329
10. Monitoring in Kubernetes...........................................................................331
Introduction...........................................................................................................331
Structure.................................................................................................................331
Objectives...............................................................................................................332
Monitoring using Prometheus and Grafana......................................................332
Prometheus.....................................................................................................332
Grafana...........................................................................................................333
Scrape metrics using Prometheus and Grafana..................................................333
EKS monitoring with CloudWatch.....................................................................337
AKS monitoring with insights.............................................................................343
GKE monitoring stack..........................................................................................346
Conclusion.............................................................................................................349
Points to remember...............................................................................................350
Multiple choice questions.....................................................................................350
Answers...........................................................................................................351
References..............................................................................................................351
11. Packaging and Deploying in Kubernetes................................................................353
Introduction...........................................................................................................353
Structure.................................................................................................................353
Objectives...............................................................................................................354
Helm package manager........................................................................................354
Helm2 versus Helm3.............................................................................................355
Deployment using Helm charts...........................................................................356
Creating Helm charts............................................................................................362
Deep dive Helm charts.........................................................................................365
Helm repositories..................................................................................................367
Helm pre and post hooks.....................................................................................372
Conclusion.............................................................................................................378
Points to remember...............................................................................................378
Multiple choice questions.....................................................................................379
Answers...........................................................................................................379
References..............................................................................................................379
12. Continuous Development and Continuous Deployment.....................................381
Introduction....................................................................................................381
Structure.................................................................................................................381
Objectives...............................................................................................................382
Understanding Skaffold........................................................................................382
Deployment of application using Skaffold.............................................................383
Understanding GitOps flux..................................................................................386
Implementing Flux CD.........................................................................................387
Conclusion.............................................................................................................397
Points to remember...............................................................................................397
Multiple choice questions.....................................................................................397
Answers...........................................................................................................397
References..............................................................................................................398
13. Managing Microservices Using Istio Service Mesh...................................................399
Introduction...........................................................................................................399
Structure.................................................................................................................399
Objectives...............................................................................................................400
Istio Service Mesh.................................................................................................400
Features of Istio Service Mesh................................................................................402
Installation of Istio Service Mesh............................................................................402
Traffic management..............................................................................................406
Weight based routing............................................................................................409
Blue–Green and Canary deployment.......................................................................410
Securing the mesh.................................................................................................411
Observability..........................................................................................................412
Conclusion.............................................................................................................416
Points to remember...............................................................................................416
Multiple choice questions.......................................................................................417
Answers..............................................................................................................417
References...........................................................................................................418
Index...................................................................................................................419

 DevOps with Kubernetes combines two powerful technologies to bring efficiency and speed to the software development process. Kubernetes has become the de facto standard for container orchestration, while DevOps practices are rapidly becoming essential for organizations to manage their software development and delivery pipelines. By using Kubernetes and DevOps practices together, teams can streamline their deployment processes, reduce errors, and deliver software faster and more reliably.
 The book starts by addressing the real-time challenges and issues that DevOps practitioners face. The book then helps you become acquainted with the fundamental and advanced Kubernetes features, and develop a comprehensive understanding of the standard CNCF components that accompany Kubernetes. The book then delves deeper into the three leading managed Kubernetes services - GKE, AKS, and EKS. Additionally, the book will help to learn how to implement security measures to protect your Kubernetes deployments. The book further explores a range of monitoring tools and techniques that can be used to quickly identify and resolve issues in Kubernetes clusters. Finally, the book will help you learn how to use the Istio Service Mesh to secure communication between workloads hosted by Kubernetes.
 With this information, you will be able to deploy, scale, and monitor apps on Kubernetes.

What you will learn

  • Learn how to manage stateful containers with Kubernetes.
  • Get to know more observability and monitoring in Kubernetes.
  • Package and deploy applications on Kubernetes using Helm.
  • Learn how to use Skaffold and Flux for CI/CD.
  • Learn how microservices can be managed and deployed using the Istio service mesh.

Who this book is for

 The book is a must-read for DevOps teams using Kubernetes to deploy container workloads. It offers valuable insights into the best practices required to make their application container-agnostic and streamline their workflows.


Похожее:

Список отзывов:

Нет отзывов к книге.