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 deep dive into some of its more common usage patterns. Then, we 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 virtual machines 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 the kubectl
command is as follows:
kubectl [command] [TYPE] [NAME] [flags]
In general, kubectl
commands execute CRUD operations – Create, Read, Update, and Delete – against Kubernetes resources, such as Pods, deployments, and Services.