Pod Design Flashcards
What is the purpose of a label?
Labels can be used to organize and to select subsets of objects. Labels are key/value pairs that are attached to objects, such as pods.
What is the purpose of a selector?
Via a label selector, the client/user can identify a set of objects. They allow kubernetes objects to be filtered by their label.
In a Pod definition, how are labels applied?
metadata: labels: key1: value1 key2: value2
What is the imperative command to select a pod with a label? (e.g. label foo with value bar)
kubectl get po --selector foo=bar
In a ReplicaSet definition, how are the pods to be managed by the ReplicaSet selected? (e.g. pods with label foo with value bar)
spec: selector: matchLabels: foo: bar
In a Service definition, how are the pods to be exposed by the Service selected? (e.g. pods with label foo and value bar)
spec: selector: foo: bar
What is the purpose of annotations?
You can use Kubernetes annotations to attach arbitrary non-identifying metadata to objects
In definition files, how are annotations applied to Kubernetes objects? (e.g. an annotation with key foo and value bar)
metadata: annotations: foo: bar
What is the imperative command for determining the status of a rollout? (e.g. for deployment named dep1)
kubectl rollout status deployment/dep1
What is the imperative command for finding the history of a rollout? (e.g. for a deployment named dep1)
kubectl rollout history deployment/dep1
What are the types of deployment strategy?
- recreate (all are destroyed before new are created)
- rolling (objects are destroyed and created one at a time)
What is the default deployment strategy?
rolling
What is the imperative command for changing the image of a single container deployment? (e.g. deployment named dep1 with an nginx image being updated to nginx:1.9.1)
kubectl set image deployment/dep1 nginx=nginx:1.9.1
What is the imperative command for rolling back a deployment? (e.g. deployment named dep1)
kubectl rollout undo deployment/dep1
What is the imperative command for getting the history of a particular rollout revision? (e.g. for the second revision of a deployment named dep1)
kubectl rollout history deployment/dep1 --revision=2