Pods, ReplicaSet, Deployments Flashcards
What format of file does Kubernetes use as input for the creation of objects as pod, deployments, services etc?
YAML files
What are the 4 top level or root level properties of a Kubernetes definition YAML files? These are also the required fields?
apiVersion:
kind:
metadata:
spec:
What is apiVersion in Kubernetes definition YAML files?
Version of the Kubernetes API used to create the object.
eg. v1, apps/v1beta
apiVersion is a single value
What is kind property in Kubernetes definition YAML files?
kind refers to the type of object we want to create.
eg. POD, ReplicaSet, Service
kind is also a single value
What is metadata in Kubernetes definition YAML files?
metadata is the data about the object, like name, label etc. This in the form of a dictionary. names and labels are children of metadata.
metadata is a dictionary
Can you tell about name and label inside metadata property of a Kubernetes definition YAML file?
name is a single value
label is again a dictionary within the metadata dictionary. It can have any key:value pair as you desire
what are labels in metadata used for?
label is like a custom dictionary, where you can add name for your app or any custom key:value pair for that object
what is spec property in in Kubernetes definition YAML files used for?
Used to provide additional details pertaining to that object including details such as the container image.
spec is a dictionary that contains a list of containers which in turn is a dictionary which contains key value pairs like
spec:
containers:
- name: name of the container
image: image of that container
Command to create pod using YAML definition file?
kubectl create -f pod-definition.yml
How to see detailed information about a pod?
kubectl describe pod myapp-pod
Which command to create a pod?
kubectl apply
or
kubectl create
Both of these can be used
How to specify the pod definition file when creating a pod?
kubectl apply -f pod.yaml
or
kubectl create -f pod.yaml
Command to check the status of the pod?
kubectl get pods
kubectl describe pod nginx
Create a pod definition file for creating nginx pod with some labels and image specified?