k8s part 2 Flashcards

1
Q

what is a label in k8s?

A

In Kubernetes (k8s), labels are key-value pairs that you attach to objects, such as pods, nodes, and services. You can label all pods that belong to a specific application or environment

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

what is the command to label a pod ?

A

kubectl label pod [pod name] key=value

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

what are selectors

A

Selectors in Kubernetes are used to filter and identify a set of objects based on their labels

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

what is the command to see all pods with labels?

A

kubectl get pods - - show-labels

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

what is the command to remove a label from a pod ?

A

kubectl label pod [pod name] key -

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

what are replica sets?

A

A ReplicaSet ensures that a specified number of identical pods are running at any given time

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

what is the command to generate a pod manifest on the cli?

A

kubectl run [pod name] - - image=[image name] - - dry-run=client -o yaml

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

what is a deployment ?

A

A deployment in Kubernetes (k8s) is a way to manage and update applications. If you need to update your app, the deployment ensures the changes are applied smoothly without downtime using replicaset.

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

what are some challenges you face if you just use a replica set?

A
  • Updating your application requires manual changes to the ReplicaSet
  • There is no built-in way to revert to a previous version if an update fails.
  • ReplicaSets do not support advanced update strategies like rolling update.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what are advantages of using a deployment ?

A
  • updates your application, ensuring new versions are rolled out smoothly.
  • If an update fails or causes issues, Deployments can easily revert to a previous version.
  • Deployments make it easy to scale your application up or down by simply changing the number of replicas
  • Ensures that the desired state of your application is consistently maintained across all replicas.
  • Automatically replaces failed or crashed pods to maintain the desired number of replicas.
  • Keeps a history of previous versions and updates, making it easier to track changes and diagnose issues.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is the command to output a deployment manifest file?

A

kubectl run deployment [name] –image=[name] - -dry-run=client -o yaml

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

what is the command to create a deployment using cli?

A

kubectl run deployment my-deployment - -image=nginx

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

what is the command to generate a deployment manifest file via CLI?

A

kubectl create deployment [name]
- -image=nginx - -dry-run=client -o yaml

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