Custom Resource Flashcards

(20 cards)

1
Q

What is a Kubernetes resource in the context of this lecture?

A

A resource is an object stored through the Kubernetes API such as a Deployment Job or custom object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the job of a built in Kubernetes controller such as the Deployment controller?

A

A controller continuously watches resources and makes changes in the cluster so the actual state matches the desired state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In the lecture example what happens behind the scenes when you create a Deployment with three replicas?

A

The Deployment controller creates a ReplicaSet and the ReplicaSet creates three Pods to match the desired replica count.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a custom resource in Kubernetes?

A

A custom resource is a new object type that you define yourself so Kubernetes can store and manage that kind of object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In the lecture example what was the custom resource called and what was it meant to represent?

A

The custom resource was called FlightTicket and it was meant to represent a flight booking request.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why does Kubernetes reject a FlightTicket manifest before a CustomResourceDefinition is created?

A

Kubernetes rejects it because the API server does not yet know that FlightTicket is a valid kind in that API group and version.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a CustomResourceDefinition or CRD?

A

A CRD is a Kubernetes object that tells the API server about a new resource type including its group names scope versions and schema.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What apiVersion and kind are used for defining a CRD?

A

The apiVersion is apiextensions.k8s.io slash v1 and the kind is CustomResourceDefinition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the scope field in a CRD control?

A

The scope field controls whether the custom resource is namespaced or cluster scoped.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What information is defined under names in a CRD?

A

The names section defines the kind singular plural and short name used for the custom resource.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the purpose of the versions section in a CRD?

A

The versions section defines which API versions exist for the custom resource which versions are served and which version is used for storage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does served mean for a CRD version?

A

Served means that version is exposed through the Kubernetes API and users can create or read objects using that version.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does storage mean for a CRD version?

A

Storage means that version is the one Kubernetes uses internally to persist the custom resource in etcd.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the purpose of the schema inside a CRD?

A

The schema defines which fields are allowed in the custom resource and what data types and validations those fields must follow.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In the FlightTicket example what fields were defined in the custom resource schema?

A

The schema defined fields such as from to and number with string and integer types plus validation rules for allowed values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does creating the CRD solve and what does it not solve?

A

Creating the CRD lets Kubernetes accept and store the custom resource but it does not make the resource perform any real world action by itself.

17
Q

What is a custom controller in Kubernetes?

A

A custom controller is a program that watches your custom resources and performs real actions when those resources are created updated or deleted.

18
Q

In the FlightTicket example what would the custom controller do?

A

The custom controller would watch FlightTicket objects and call an external booking API to create or cancel actual flight bookings.

19
Q

Why is a custom resource without a controller usually not enough?

A

Without a controller the custom resource is only data stored in etcd and nothing in the cluster acts on it.

20
Q

What is the key idea to remember about CRDs and controllers working together?

A

The CRD defines and validates the new object type while the custom controller gives that object behavior and makes it useful.