Bitzu

KCNA ยท Kubernetes core concepts

kubectl basics

Core kubectl verbs (get, describe, apply, create, delete, explain), output formats, imperative vs declarative commands.

Key points

  • kubectl is the command-line client for the Kubernetes API.
  • Read verbs: get (list), describe (details and events), explain (field docs).
  • Write verbs: create (imperative, fails if the object exists), apply (declarative, creates or updates from a manifest) and delete.
  • Output formats such as -o yaml, -o json or -o name change how results are printed.

Source: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_deployment/

Practice questions

Single choice

Which kubectl verb prints detailed, human-readable information about an object, including its recent events?

  1. kubectl explain
  2. kubectl describe
  3. kubectl apply
  4. kubectl create
Show answer

Answer: B. kubectl describe

describe aggregates the object's details and related events. explain documents the schema, not a live object.

Select all that apply

Which kubectl verbs only read information and never change cluster objects?

  1. get
  2. delete
  3. describe
  4. apply
  5. explain
Show answer

Answer: A. get, C. describe, E. explain

get, describe and explain are read-only. delete removes objects and apply creates or updates them.

True or false

When the object already exists, kubectl create -f and kubectl apply -f behave the same way.

Show answer

Answer: False

create is imperative and reports an error for an existing object. apply is declarative and updates it to match the manifest.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More KCNA topics in this module