Core Concepts Flashcards
What is the command to create a pod
kubectl run nginx –image nginx
How do you delete a pod
kubectl delete pod <pod></pod>
How do you create a pod definition file using dry-run
kubectl run nginx –image=nginx –dry-run=client -o yaml
What does a pod deployment look like
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
How do you find out about a object type ex. ReplicaSet
kubectl explain replicaset
Does the label in the selector for replicasets have to match the label in the template?
Yes
How do you modify an object when you don’t really know where the yaml file is?
kubectl edit <object> rs <name></name></object>
How do you create a deployment yaml file with replicas set
kubectl create deployment –image=nginx nginx –replicas=4 –dry-run=client -o yaml > nginx-deployment.yaml
How do you get all of the resources that are in a cluster
kubectl get all
What are the 3 types of Services (load balancers)
NodePort, ClusterIP, Loadbalancer
Is the Service type of LoadBalancer available everywhere?
No. It is only allowed with Cloud Providers that can support it. It is mentioned in the training that all of the big 3 meet the requirements.
How do you set the namespace you want to work in?
kubectl config set-context $(kubectl config current-context) –namespace=<namespace></namespace>
How do you manually schedule a pod?
Easiest way is to just put a nodeName field in the Pod definition file. You can also create a binding definition file, you need convert that to a JSON formatted file and send a binding request to the nodes binding API.
How do you look for the components of the k8s environment?
kubectl get pods -n kube-system
How do you find a resource by its label?
kubectl get pod –selector app=App1