Getting Edgy: What is Kubectl? (2024)

GETTING EDGY

Getting Edgy: What is Kubectl? (3)

Kubectl is a command line tool used to run commands against Kubernetes clusters. It does this by authenticating with the Master Node of your cluster and making API calls to do a variety of management actions. If you’re just getting started with Kubernetes, prepare to be spending a lot of time with kubectl!

How to Use kubectl

The format of a kubectl command looks like this:

kubectl[command][type][name][flags] 
  • [command]: specifies the action you want to perform like create, delete, get, apply
  • [type]: any Kubernetes resource, whether automatically provided by Kubernetes (like a service or a pod) or created by you with a Custom Resource Definition
  • [name]: the name you have given the resource — if you omit the name, kubectl will return every resource specified by the type
  • [flags]: specify any additional global or command specific options such as the output format

An example of a command using the full command format is

kubectl get pods hello-world -o yaml

which will make a call to the kubernetes api and output the configuration of a pod named hello-world in yaml format.

Since the name is optional, some commands you will commonly execute will completely omit it such as

kubectl apply -f hello-world.yaml

which will apply a configuration defined in the hello-world.yaml file.

Learn More

Other useful tools:

Subscribe to the Ambassador YouTube Channel to get updates about new weekly videos!

Getting Edgy: What is Kubectl? (2024)
Top Articles
Latest Posts
Article information

Author: Tuan Roob DDS

Last Updated:

Views: 6073

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Tuan Roob DDS

Birthday: 1999-11-20

Address: Suite 592 642 Pfannerstill Island, South Keila, LA 74970-3076

Phone: +9617721773649

Job: Marketing Producer

Hobby: Skydiving, Flag Football, Knitting, Running, Lego building, Hunting, Juggling

Introduction: My name is Tuan Roob DDS, I am a friendly, good, energetic, faithful, fantastic, gentle, enchanting person who loves writing and wants to share my knowledge and understanding with you.