Deployments Flashcards
Is POD gets restarts by itself, if it goes down ?
No, some other mechanism is required to replace the POD.
What is the main role of Deployment object in kubernetes?
Manage replica sets thereby managing pod
What is a replica set ?
It is used to manage the PODs.
What is a deployment ?
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.
What are the main objectives of Replica Sets ?
- POD management - No need to create the pods separately, it creates them
- Auto-scaling: Increase the number of PODs if required by the user
- Self healing: Keep the number of PODs as mentioned by the user
What are the main objectives of Deployments?
- Replica set management - No need to create the replica set, it creates them
- Auto-scaling: It scales replica sets, which scales PODs
- Self-healing: It increases the number of PODs, by scaling the replica sets
- Zero-downtime updates
- Rollback functionality
- Tagging mechanism using “labels”
Do we need to create both Replica sets and Deployments ?
No.
Deployments are wrapper above replica sets. Hence once we create the Deployments, it automatically creates the Replica sets automatically.
Do we need to provide “specs” for “replica sets” while creating the “Deployment” ?
No.
Only POD specs are required. Replica sets gets created automatically.
Define Deployment manifest ?
apiVersion: v1
kind: Deployment
metadata:
spec:
selector:
template:
spec:
containers:
- name: my-nginx
image: nginx:alpine
Where we provide the “labels” in manifest ?
Inside the “meta-data”
metadata:
name: frontend
labels:
key: value
what are the two main objectives of using “labels” ?
- To query a resource e.g. get Everything having label - “mylabel”
- To Group objects together e.g. Deploy everything with label - “myLabel”
What’s the command to create a deployment object?
> > > kubectl apply -f myFile.deployment.yaml
How to get all the deployments running in kubectl ?
> > > kubectl get deployment
How to show all the labels of the deployments ?
> > > kubectl get deployment –show-labels
How to filter out the deployments based on “labels” ?
> > > kubectl get deployment -l app=nginx –show-labels