kubectl: Command-Line Kubernetes in a Nutshell

Book description

Manage Kubernetes applications using kubectl and discover the different Kubernetes clusters

Key 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 subcommands

Book Description

The 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 develop and extend kubectl tools with their own plugins
  • Explore how to use Helm as an advanced tool for deploying apps

Who this book is for

This 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.

Table of contents

  1. kubectl: Command-Line Kubernetes in a Nutshell
  2. Why subscribe?
  3. Contributors
  4. About the author
  5. About the reviewer
  6. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Reviews
  8. Section 1: Getting Started with kubectl
  9. Chapter 1: Introducing and Installing kubectl
    1. Technical requirements
    2. Introducing kubectl
    3. Installing kubectl
      1. Installing on macOS
      2. Installing on Windows
      3. Installing on Linux
    4. kubectl commands
      1. Basic commands
      2. Deploy commands
      3. Cluster management commands
      4. Troubleshooting and debugging commands
      5. Advanced commands
      6. Settings commands
      7. Other commands
    5. Summary
  10. Section 2: Kubernetes Cluster and Node Management
  11. Chapter 2: Getting Information about a Cluster
    1. Cluster information
    2. Cluster API versions
    3. Cluster resources list
    4. Summary
  12. Chapter 3: Working with Nodes
    1. Getting a list of nodes
    2. Describing nodes
    3. Displaying node resource usage
    4. Cordoning nodes
    5. Draining nodes
    6. Removing nodes
    7. Introduction to node pools
    8. Summary
  13. Section 3: Application Management
  14. Chapter 4: Creating and Deploying Applications
    1. Introduction to pods
    2. Creating a deployment
    3. Creating a service
    4. Scaling up an application
    5. Summary
  15. Chapter 5: Updating and Deleting Applications
    1. Deploying a new application version
    2. Rolling back an application release
    3. Assigning an application to a specific node (node affinity)
    4. Scheduling application replicas to different nodes (pod affinity)
    5. Exposing an application to the internet
    6. Deleting an application
    7. Summary
  16. Chapter 6: Debugging an Application
    1. Describing a pod
    2. Checking pod logs
    3. Executing a command in a running container
    4. Summary
  17. Section 4: Extending kubectl
  18. Chapter 7: Working with kubectl Plugins
    1. Installing plugins
    2. Using plugins
    3. Creating a basic plugin
    4. Summary
  19. Chapter 8: Introducing Kustomize for Kubernetes
    1. Introduction to Kustomize
    2. Patching a Kubernetes application
      1. Kustomize overlays
    3. Summary
  20. Chapter 9: Introducing Helm for Kubernetes
    1. Introduction to Helm
      1. The Helm CLI
      2. Helm charts
      3. Chart templating
      4. Repositories
      5. Releases
    2. Installing applications using Helm charts
    3. Upgrading Helm releases
    4. Rolling back to a previous Helm release
    5. Using Helm's template command
    6. Creating a Helm chart
    7. Using Helm's linting feature
    8. Extending Helm with plugins
    9. Summary
  21. Chapter 10: kubectl Best Practices and Docker Commands
    1. Using shell aliases for kubectl commands
    2. Similar Docker commands in kubectl
    3. Summary
  22. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: kubectl: Command-Line Kubernetes in a Nutshell
  • Author(s): Rimantas Mocevicius
  • Release date: November 2020
  • Publisher(s): Packt Publishing
  • ISBN: 9781800561878