Orchestration: Kubernetes Flashcards
What to all install when installing K8s?
- kubectl
- K8s Master
- Worker node agents
How to run a pod using the soon to be deprecated method?
kubectl run mywebserver –image=nginx
How to exec into a pod?
kubectl exec -it mywebserver-xyz – bash
How to delete a pod?
kubectl delete pod mywebserver-xyz
What is an object?
Object is a record of intent, once created K8s will work to ensure that the object exists.
How to create a K8s object via YAML configuration file?
kubectl apply -f file.yaml
How to delete a K8s object via YAML configuration file?
kubectl delete -f file.yaml
What is a the purpose of a ReplicaSet?
To maintain a set of replica pods
What are the two states of pods in a ReplicaSet?
Current and Desired
How to view the labels of pods?
kubectl get pods –show-labels
What does the “selector / matchLabels” section do in ReplicaSets?
Determines which label is used to count the number of current pods for the ReplicaSet
What is the main difference between a ReplicaSet and a Deployment?
Deployment sits on top of ReplicaSets, with features like rolling out updates and rolling back.
How does a Deployment rollout changes?
Creates a new ReplicaSet, once running, deletes old ReplicaSet.
Equivalent K8s command for docker inspect?
kubectl describe resource_type resource_name
How to get the rollout history for a deployment?
kubectl rollout history deployment.v1.apps/my_deployment
How to get information about a specific deployment revision?
kubectl deployment history deployment.v1.apps/my_deployment –revision=1
What is the default max unavailable pods and maximum surge during a deployment rollout?
25%
For deployment rollout, which parameter determines the max number of pods that can be scheduled above the original number of pods?
maxSurge
For deployment rollout, which parameter determines the maximum amount of pods that can be unavailable during the deployment?
maxUnavailable
Two different ways of getting information about a resource (pod/deployment/replicaset/etc)
kubectl get pod my_pod -o yaml
kubectl describe pod my_pod
How to create a new basic K8s secret with a literal value?
kubectl create secret generic my_secret –from-literal=dbpass=password123
How to create a new basic K8s secret from a file?
kubectl create secret generic my_secret –from-file=./file.txt
What are two approaches to make secrets available to Pods?
Environment Variables
Volumes
How to create a ConfigMap
kubectl create configmap my_config –from-literal=memory=2048m