Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering Linux Administration - Second Edition

You're reading from  Mastering Linux Administration - Second Edition

Product type Book
Published in Mar 2024
Publisher Packt
ISBN-13 9781837630691
Pages 764 pages
Edition 2nd Edition
Languages
Authors (2):
Alexandru Calcatinge Alexandru Calcatinge
Profile icon Alexandru Calcatinge
Julian Balog Julian Balog
Profile icon Julian Balog
View More author details

Table of Contents (24) Chapters

Preface 1. Part 1:Basic Linux Administration
2. Chapter 1: Installing Linux 3. Chapter 2: The Linux Shell and Filesystem 4. Chapter 3: Linux Software Management 5. Chapter 4: Managing Users and Groups 6. Chapter 5: Working with Processes, Daemons, and Signals 7. Part 2:Advanced Linux Administration
8. Chapter 6: Working with Disks and Filesystems 9. Chapter 7: Networking with Linux 10. Chapter 8: Linux Shell Scripting 11. Chapter 9: Securing Linux 12. Chapter 10: Disaster Recovery, Diagnostics, and Troubleshooting 13. Part 3:Server Administration
14. Chapter 11: Working with Virtual Machines 15. Chapter 12: Managing Containers with Docker 16. Chapter 13: Configuring Linux Servers 17. Part 4:Cloud Administration
18. Chapter 14: Short Introduction to Cloud Computing 19. Chapter 15: Deploying to the Cloud with AWS and Azure 20. Chapter 16: Deploying Applications with Kubernetes 21. Chapter 17: Infrastructure and Automation with Ansible 22. Index 23. Other Books You May Enjoy

Deploying Applications with Kubernetes

Whether you are a seasoned system administrator managing containerized applications or a DevOps engineer automating app orchestration workflows, Kubernetes could be your platform of choice. This chapter will introduce you to Kubernetes and will guide you through the basic process of building and configuring a Kubernetes cluster. We’ll use Kubernetes to run and scale a simple application in a secure and highly available environment. You will also learn how to interact with Kubernetes using the command-line interface (CLI).

By the end of this chapter, you’ll learn how to install, configure, and manage a Kubernetes cluster on-premises. We’ll also show you how to deploy and scale an application using Kubernetes.

Here’s a brief outline of the topics we will cover in this chapter:

  • Introducing Kubernetes architecture and the API object model
  • Installing and configuring Kubernetes
  • Working with Kubernetes...

Technical requirements

You should be familiar with Linux and the CLI in general. A good grasp of TCP/IP networking and Docker containers would go a long way in making your journey of learning Kubernetes easier.

You will also need the following:

  • A local desktop machine with a Linux distribution of your choice to install and experiment with the CLI tools used in this chapter. We will use both Debian and Ubuntu LTS.
  • A powerful desktop system with at least 8 CPU cores and at least 16 GB of RAM will allow you to replicate the necessary environment on your desktop as we’ll be devoting a relatively large section to building a Kubernetes cluster using VMs.
  • A desktop hypervisor.

Now, let’s start our journey together to discover Kubernetes.

Introducing Kubernetes

Kubernetes is an open source container orchestrator initially developed by Google. A container orchestrator is a piece of software that automatically manages (including provisioning, deployment, and scaling) containerized applications. Assuming an application uses containerized microservices, a container orchestration system provides the following features:

  • Elastic orchestration (autoscaling): This involves automatically starting and stopping application services (containers) based on specific requirements and conditions – for example, launching multiple web server instances with an increasing number of requests and eventually terminating servers when the number of requests drops below a certain threshold
  • Workload management: This involves optimally deploying and distributing application services across the underlying cluster to ensure mandatory dependencies and redundancy – for example, running a web server endpoint on each cluster...

Installing and configuring Kubernetes

Before installing or using Kubernetes, you have to decide on the infrastructure you’ll use, whether that be on-premises or public cloud. Second, you’ll have to choose between an Infrastructure-as-a-Service (IaaS) or a Platform-as-a-Service (PaaS) model. With IaaS, you’ll have to install, configure, manage, and maintain the Kubernetes cluster yourself, either on physical (bare metal) or VMs. The related operation efforts are not straightforward and should be considered carefully. If you choose a PaaS solution, available from all major public cloud providers, you’ll be limited to only administrative tasks but saved from the burden of maintaining the underlying infrastructure.

In this chapter, we’ll cover only IaaS deployments of Kubernetes. For IaaS, we’ll use a local desktop environment running Ubuntu VMs.

For the on-premises installation, we may also choose between a lightweight desktop version of...

Working with Kubernetes

In this section, we’ll use real-world examples of interacting with a Kubernetes cluster. Since we’ll be using the kubectl CLI to a considerable extent, we’re going to take a deep dive into some of its more common usage patterns. Then, we will turn our focus to deploying applications to a Kubernetes cluster. We’ll be using the on-premises environment we built in the Installing Kubernetes on VMs section.

Let’s start by taking a closer look at kubectl and its usage.

Using kubectl

kubectl is the primary tool for managing a Kubernetes cluster and its resources. kubectl communicates with the cluster’s API server endpoint using the Kubernetes REST API. The general syntax of a kubectl command is as follows:

kubectl [command] [TYPE] [NAME] [flags]

In general, kubectl commands execute CRUD operations – CRUD stands for Create, Read, Update, and Delete – against Kubernetes resources, such as pods, Deployments...

Summary

We began this chapter with a high-level overview of the Kubernetes architecture and API object model, introducing the most common cluster resources, such as pods, Deployments, and Services. Next, we took on the relatively challenging task of building an on-premises Kubernetes cluster from scratch using VMs. We explored various CLI tools for managing Kubernetes cluster resources on-premises. At the high point of our journey, we focused on deploying and scaling applications in Kubernetes using imperative and declarative Deployment scenarios.

We believe that novice Linux administrators will benefit greatly from the material covered in this chapter and become more knowledgeable in managing resources across hybrid clouds and on-premises distributed environments, deploying applications at scale, and working with CLI tools. We believe that the structured information in this chapter will also help seasoned system administrators refresh some of their knowledge and skills in the areas...

Questions

Here are a few questions for refreshing or pondering upon some of the concepts you’ve learned in this chapter:

  1. Enumerate some of the essential Services of a Kubernetes CP node. How do the worker nodes differ?
  2. What command did we use to bootstrap a Kubernetes cluster?
  3. What is the difference between imperative and declarative Deployments in Kubernetes?
  4. What is the kubectl command for deploying a pod? How about the command for creating a Deployment?
  5. What is the kubectl command to access the shell within a pod container?
  6. What is the kubectl command to query all resources related to a Deployment?
  7. How do you scale out a Deployment in Kubernetes? Can you think of the different ways (commands) in which to accomplish the task?
  8. How do you delete all resources related to a Deployment in Kubernetes?

Further reading

The following resources may help you to consolidate your knowledge of Kubernetes further:

The following is a short list of useful links for deploying Kubernetes on Azure, Amazon, and Google:

lock icon The rest of the chapter is locked
You have been reading a chapter from
Mastering Linux Administration - Second Edition
Published in: Mar 2024 Publisher: Packt ISBN-13: 9781837630691
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}