I’ve been working with Kubernetes for a while now and and I’m really enjoying it. I feel I’ve learned quite a bit but its difficult to know how much without some kind of measuring stick. With that in mind I’ve decided to start studying for the Certified Kubernetes Application Developer (CKAD) exam.

When studying for certs in the past I’ve usually scribbled notes privately in Evernote. This time though I’m going to share them here in a series of posts. It seems a waste to put time and effort into notes and not share them. Putting the notes in the public domain will hopefully help other folks studying for the CKAD and help keep me motivated to get through the material quickly.

Ok, enough chit chat….lets get started.

Kubernetes API Primitives

Kubernetes API primitives are data objects that represent the state of the cluster. They’re often referred to as Kubernetes Objects. Examples are

  • Node
  • Pod
  • Replica Set
  • Service

To see a full list of Kubernetes Objects available run kubectl api-resources.

Every Kubernetes Object has a Spec and a Status.

  • Spec – defines the desired state of the object running in the cluster. Usually defined in a yaml file and applied to the cluster using kubectl
  • Status – Current state of the object in the cluster. This can be retrieved from the cluster using kubectl

Viewing Kubernetes Objects

To view a list of Kubernetes objects of a certain type use the kubectl get command. For example to view all Nodes run kubectl get nodes.

I’m running minikube locally so I only have 1 node, but if I were connected to a cluster with multiple nodes, they’d all be listed here.

To see detailed metadata associated with an object you can run kubectl get node minikube -o yaml. The yaml output contains lots of information regarding the Object including its Spec and Status.

Another way to view detailed metadata for an object is the kubectl describe command. For example, to view detail for the minikube node run kubectl describe node minikube.