Kubernetes for the Absolute Beginners Flashcards
What is the command to deploy a NGINX pod?
kubectl run nginx –image=nginx
What is the command to list pods?
kubectl get pods
What is the command to get more information about a pod?
kubectl describe pod <pod_name></pod_name>
What is the command to check the status of the pod with additional information?
kubectl get pods -o wide
What is the command to list nodes?
kubectl get nodes
What is the command to get verbose information about a node?
kubectl describe node
What are the 4 root or top level configurations in your pod-definition.yml?
apiVersion:
kind:
metadata:
spec:
What is the command to apply a pod.yaml file?
kubectl apply -f pod.yml
What is the command to delete a pod?
kubectl delete pod <pod_name></pod_name>
What is the command to dry run and output a pod to yaml?
kubectl run image –image=<image_name> --dry-run -o yml</image_name>
What does a replication controller do in an environment where a single pod is running and the pod fails?
Brings up a new one
What is replacing the replica controller
Replication Set
What is the command to create a replica controller from a file?
kubectl create -f <filename>.yml</filename>
What is the command to list the replication controller?
kubectl get replicationcontroller
What is the command to create a replica set from a file?
kubectl create -f <filename>.yml</filename>
What is the command to list the replication controller?
kubectl get replicaset
How does a replica set know what pods to monitor in a cluster with many other pods?
selector:
matchLabels:
tier: <label></label>
What command updates the replica set after updating the number of replicas in the yaml file?
kubectl replace -f <filename>.yml</filename>
What command updates the replica set using only a kubectl command?
kubectl scale –replicas=<number> -f <filename>.yml</filename></number>
What command updates the replica set using only a kubectl command without specifying the filename?
kubectl scale –replicas=<number> -f <metadata>
eg. kubectl scale --replicas=<number> -f myapp-replicaset</number></metadata></number>
What command allows you to edit the existing replicaset definition file?
kubectl edit replicaset <replicaset_name></replicaset_name>
What are the 3 fields required for the replicaset spec section?
spec:
replicas:
template:
selector:
What command returns all K8 obejcts
kubectl get all
What is the command to see the status of a rollout?
k rollout status deployment/<deployment_name></deployment_name>
What is the command to see the history of a rollout?
k rollout history deployment/<deployment_name></deployment_name>
What is the command to rollback a deployment=?
k rollout undo deployment/<deployment_name></deployment_name>
What is the command to update an image in a deployment?
k set image deployment <deployment_name> <container_name>=<image_version></image_version></container_name></deployment_name>
What are the spec requirements for creating a NodePort service?
spec:
type: NodePort
ports:
- targetPort: <port_number>
port: <port_number>
nodePort: <30000 - 32767></port_number></port_number>
How do you link a pod to a service?
Pull the labels from the pod definition file and add them under selector
What is the command to create a service?
k create -f <service-file.yml></service-file.yml>
What is the command to see the services?
k get services
k get svc
What command would you use to get both pods and services?
k get pods,svc