kubectl: Command-Line Kubernetes in a Nutshell
eBook - ePub

kubectl: Command-Line Kubernetes in a Nutshell

  1. 136 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

kubectl: Command-Line Kubernetes in a Nutshell

Book details
Book preview
Table of contents
Citations

About This Book

Manage Kubernetes applications using kubectl and discover the different Kubernetes clustersKey Features• Explore the Kubernetes command line for deploying applications, inspecting clusters, and viewing logs• Leverage kubectl for Kubernetes application management and container debugging• Apply your knowledge of Docker to learn kubectl equivalent commands for Docker subcommandsBook DescriptionThe kubectl command line tool lets you control Kubernetes clusters to manage nodes in the cluster and perform all types of Kubernetes operations. This introductory guide will get you up to speed with kubectl in no time. The book is divided into four parts, touching base on the installation and providing a general overview of kubectl in the first part. The second part introduces you to managing Kubernetes clusters and working with nodes. In the third part, you'll be taken through the different ways in which you can manage Kubernetes applications, covering how to create, update, delete, view, and debug applications. The last part of the book focuses on various Kubernetes plugins and commands. You'll get to grips with using Kustomize and discover Helm, a Kubernetes package manager. In addition to this, you'll explore how you can use equivalent Docker commands in kubectl. By the end of this book, you'll have learned how to install and update an application on Kubernetes, view its logs, and inspect clusters effectively.What you will learn• Get to grips with the basic kubectl commands• Delve into different cluster nodes and their resource usages• Understand the most essential features of kubectl• Discover how to patch Kubernetes deployments with Kustomize• Find out ways to extend kubectl tools with their own plugins• Explore how to use Helm as an advanced tool for deploying appsWho this book is forThis book is for developers, system administrators, and anyone who wants to use the kubectl command-line tool to perform Kubernetes functionalities. A basic understanding of Kubernetes and Docker is required to get started with this book.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access kubectl: Command-Line Kubernetes in a Nutshell by Rimantas Mocevicius in PDF and/or ePUB format, as well as other popular books in Computer Science & Software Development. We have over one million books available in our catalogue for you to explore.

Information

Year
2020
ISBN
9781800564572
Edition
1

Section 1: Getting Started with kubectl

In this section, you will learn what kubectl is and how to install it.
This section contains the following chapter:
  • Chapter 1, Introducing and Installing kubectl

Chapter 1: Introducing and Installing kubectl

Kubernetes is an open source container orchestration system for managing containerized applications across multiple hosts in a cluster.
Kubernetes provides mechanisms for application deployment, scheduling, updating, maintenance, and scaling. A key feature of Kubernetes is that it actively manages containers to ensure that the state of the cluster always matches the user's expectations.
Kubernetes enables you to respond quickly to customer demand by scaling or rolling out new features. It also allows you to make full use of your hardware.
Kubernetes is the following:
  • Lean: Lightweight, simple, and accessible
  • Portable: Public, private, hybrid, and multi-cloud
  • Extensible: Modular, pluggable, hookable, composable, and toolable
  • Self-healing: Auto-placement, auto-restart, and auto-replication
Kubernetes builds on a decade and a half of experience at Google running production workloads at scale, combined with best-of-breed ideas and best practices from the community:
Figure 1.1 – A 10,000-foot view of Kubernetes' architecture
Figure 1.1 – A 10,000-foot view of Kubernetes' architecture
One of the ways to manage Kubernetes clusters is kubectl—Kubernetes' command-line tool for management, it is a tool for accessing a Kubernetes cluster that allows you to run different commands against Kubernetes clusters to deploy apps, manage nodes, troubleshoot deployments, and more.
In this chapter, we're going to cover the following main topics:
  • Introducing kubectl
  • Installing kubectl
  • kubectl commands

Technical requirements

To learn kubectl, you will need access to a Kubernetes cluster; it can be one of these cloud ones:
  • Google Cloud GKE: https://cloud.google.com/kubernetes-engine
  • Azure AKS EKS: https://azure.microsoft.com/en-us/free/kubernetes-service
  • AWS EKS: https://aws.amazon.com/eks/
  • DigitalOcean DOKS: https://www.digitalocean.com/docs/kubernetes/
Alternatively, it can be a local one:
  • KIND: https://kind.sigs.k8s.io/docs/user/quick-start/
  • Minikube: https://kubernetes.io/docs/setup/learning-environment/minikube/
  • Docker Desktop: https://www.docker.com/products/docker-desktop
In this book, we are going to use Google Cloud's GKE Kubernetes cluster.

Introducing kubectl

You can use kubectl to deploy applications, inspect and manage them, check cluster resources, view logs, and more.
kubectl is a command-line tool that can run from your computer, in CI/CD pipelines, as part of the operating system, or as a Docker image. It is a very automation-friendly tool.
kubectl looks for a configuration file named .kube in the $HOME folder. In the .kube file, kubectl stores the cluster configurations needed to access a Kubernetes cluster. You can also set the KUBECONFIG environment variable or use the --kubeconfig flag to point to the kubeconfig file.

Installing kubectl

Let's take a look at how you can install kubectl on macOS, on Windows, and in CI/CD pipelines.

Installing on macOS

The easiest way to install kubectl on macOS is using the Homebrew package manager (https://brew.sh/):
  1. To install, run this:
    $ brew install kubectl
  2. To see the version you have installed, use this:
    $ kubectl version –client --short
    Client Version: v1.18.1

Installing on Windows

To install kubectl on Windows, you could use the simple command-line installer Scoop (https://scoop.sh/):
  1. To install, run this:
    $ scoop install kubectl
  2. To see the version you have installed, use this:
    $ kubectl version –client --short
    Client Version: v1.18.1
  3. Create the .kube directory in your home directory:
    $ mkdir %USERPROFILE%\.kube
  4. Navigate to the .kube directory:...

Table of contents

  1. kubectl: Command-Line Kubernetes in a Nutshell
  2. Why subscribe?
  3. Preface
  4. Section 1: Getting Started with kubectl
  5. Chapter 1: Introducing and Installing kubectl
  6. Section 2: Kubernetes Cluster and Node Management
  7. Chapter 2: Getting Information about a Cluster
  8. Chapter 3: Working with Nodes
  9. Section 3: Application Management
  10. Chapter 4: Creating and Deploying Applications
  11. Chapter 5: Updating and Deleting Applications
  12. Chapter 6: Debugging an Application
  13. Section 4: Extending kubectl
  14. Chapter 7: Working with kubectl Plugins
  15. Chapter 8: Introducing Kustomize for Kubernetes
  16. Chapter 9: Introducing Helm for Kubernetes
  17. Chapter 10: kubectl Best Practices and Docker Commands
  18. Other Books You May Enjoy