Chapter 6. Labels and Annotations Flashcards

1
Q

What are labels ?

A

Labels provide identifying metadata for objects. These are fundamental qualities of the object that will be used for grouping, viewing, and operating.

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

Command to create labels:

A

kubectl run alpaca-prod \

  • -image=gcr.io/kuar-demo/kuard-amd64:blue \
  • -replicas=2 \
  • -labels=”ver=1,app=alpaca,env=prod”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Command to show labels:

A

kubectl get deployments –show-labels

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

Command to edit labels:

A

kubectl label deployments alpaca-test “canary=true”

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

Command to show a label value as a column:

A

kubectl get deployments -L canary

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

Command to remove a label:

A

kubectl label deployments alpaca-test “canary-“

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

Command to list pods based on a specific label:

A

kubectl get pods –selector=”ver=2”

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

Command to specify to selector ( will behave as an AND operation):

A

kubectl get pods –selector=”app=bandicoot,ver=2”

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

Command to ask if a label is in a set of values:

A

kubectl get pods –selector=”app in (alpaca,bandicoot)”

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

Command to ask if a label is set at all:

A

kubectl get deployments –selector=”canary”

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

What are annotations ?

A

Annotations provide a place to store additional metadata for Kubernetes objects with the sole purpose of assisting tools and libraries.

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

What are labels selectors ?

A

Label selectors are used to filter Kubernetes objects based on a set of labels.

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

Command to clean all deployments:

A

kubectl delete deployments –all

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