Deployments Flashcards

1
Q

Is POD gets restarts by itself, if it goes down ?

A

No, some other mechanism is required to replace the POD.

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

What is the main role of Deployment object in kubernetes?

A

Manage replica sets thereby managing pod

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

What is a replica set ?

A

It is used to manage the PODs.

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

What is a deployment ?

A

It is used to manage the “replica sets”.
The “replica set” came before “deployments”. The main objective behind “deployments” is to simplify the process of managing replica sets.

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

What are the main objectives of Replica Sets ?

A
  1. POD management - No need to create the pods separately, it creates them
  2. Auto-scaling: Increase the number of PODs if required by the user
  3. Self healing: Keep the number of PODs as mentioned by the user
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the main objectives of Deployments?

A
  1. Replica set management - No need to create the replica set, it creates them
  2. Auto-scaling: It scales replica sets, which scales PODs
  3. Self-healing: It increases the number of PODs, by scaling the replica sets
  4. Zero-downtime updates
  5. Rollback functionality
  6. Tagging mechanism using “labels”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Do we need to create both Replica sets and Deployments ?

A

No.
Deployments are wrapper above replica sets. Hence once we create the Deployments, it automatically creates the Replica sets automatically.

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

Do we need to provide “specs” for “replica sets” while creating the “Deployment” ?

A

No.
Only POD specs are required. Replica sets gets created automatically.

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

Define Deployment manifest ?

A

apiVersion: v1
kind: Deployment
metadata:
spec:
selector:
template:
spec:
containers:
- name: my-nginx
image: nginx:alpine

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

Where we provide the “labels” in manifest ?

A

Inside the “meta-data”
metadata:
name: frontend
labels:
key: value

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

what are the two main objectives of using “labels” ?

A
  1. To query a resource e.g. get Everything having label - “mylabel”
  2. To Group objects together e.g. Deploy everything with label - “myLabel”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What’s the command to create a deployment object?

A

> > > kubectl apply -f myFile.deployment.yaml

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

How to get all the deployments running in kubectl ?

A

> > > kubectl get deployment

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

How to show all the labels of the deployments ?

A

> > > kubectl get deployment –show-labels

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

How to filter out the deployments based on “labels” ?

A

> > > kubectl get deployment -l app=nginx –show-labels

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

How to delete a deployment ?

A

> > > kubectl delete deployment [deployment-name]

17
Q

Can we scale deployment?

A

No, only replica can be scaled.

18
Q

How to provide scaling configuration in YAML file ?

A

Inside the Deployment “Spec”:
spec:
replicas: 3
selector:

19
Q

How to provide the scaling configuration from command line ?

A

> > > kubectl scale -f myFile.deployment.yaml –replicas=5

20
Q

How to bound the Template with the selector ?

A

By Matching the label of “template” with “matchlabel”.

21
Q

How to provide labels to the “template” within Deployment manifest ?

A

template:
metadata:
labels:
key1: value1

22
Q

How to update already deployed deployment ?

A

> > > kubectl apply -f myFile.yml
This will update the existing configuration

23
Q

What is the meaning of ZERO downtime update using Deployment ?

A

It means, Deployments allows us to update our containers without any downtime.

24
Q

What are the different Deployment Options provided by the Kubernetes ?

A
  1. Rolling Update
  2. Blue-Green Deployment
  3. Canary Deployment
  4. Rollback Deployment
25
Q

What is the default deployment option given by Kuberentes ?

A

Rolling update

26
Q

How Rolling update deployment works in K8s?

A
  1. A new container will be deployed with new version
  2. Once its ready to receive request (monitored by readiness probe), one of old version gets terminated
  3. This sequence continues to get run, until all older version gets removed
27
Q

How to run “rolling update” deployment ?

A

It is default option.
»>
kubectl apply -f my-nginx.deployment.yaml

28
Q
A