Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
kubectl: Command-Line Kubernetes in a Nutshell

You're reading from   kubectl: Command-Line Kubernetes in a Nutshell Deploy, manage, and debug container workloads using the Kubernetes CLI

Arrow left icon
Product type Paperback
Published in Nov 2020
Publisher Packt
ISBN-13 9781800561878
Length 136 pages
Edition 1st Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Rimantas Mocevicius Rimantas Mocevicius
Author Profile Icon Rimantas Mocevicius
Rimantas Mocevicius
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

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

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:
    $ cd %USERPROFILE%\.kube
  5. Configure kubectl to use a remote Kubernetes cluster:
    $ New-Item config -type file

Installing on Linux

When you want to use kubectl on Linux, you have two options:

  • Use curl:
    $ curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
  • If your Linux system supports Docker images, use https://hub.docker.com/r/bitnami/kubectl/.

    Note

    Linux is a very common environment for CI/CD pipelines.

You have been reading a chapter from
kubectl: Command-Line Kubernetes in a Nutshell
Published in: Nov 2020
Publisher: Packt
ISBN-13: 9781800561878
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 €18.99/month. Cancel anytime