-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.json
1 lines (1 loc) · 14.8 KB
/
db.json
1
[{"model": "flashcards.card_set", "pk": 1, "fields": {"topic": "CKA Exam", "description": "Certified Kubernetes Administrator", "is_active": true}}, {"model": "flashcards.card", "pk": 1, "fields": {"parent_card_set": 1, "question": "Command to list all pods in all namespaces?", "answer": "kubectl get pods -A"}}, {"model": "flashcards.card", "pk": 2, "fields": {"parent_card_set": 1, "question": "Command to create a new pod with the name nginx and with the nginx image?", "answer": "kubectl run nginx --image=nginx"}}, {"model": "flashcards.card", "pk": 3, "fields": {"parent_card_set": 1, "question": "Command to view what image was used to create a pod called 'mypod' in the default namespace?", "answer": "kubectl describe pod mypod"}}, {"model": "flashcards.card", "pk": 4, "fields": {"parent_card_set": 1, "question": "Command to show which nodes a pod is placed on in default namespace?", "answer": "kubectl get pod -o wide"}}, {"model": "flashcards.card", "pk": 5, "fields": {"parent_card_set": 1, "question": "Command to determine how many containers are part of the pod myapp?", "answer": "kubectl describe pod myapp\r\n\r\nLook under the Containers section to view number of containers."}}, {"model": "flashcards.card", "pk": 6, "fields": {"parent_card_set": 1, "question": "Command to create a deployment called list with image nginx in the default namespace?", "answer": "kubectl create deployment list --image=nginx"}}, {"model": "flashcards.card", "pk": 7, "fields": {"parent_card_set": 1, "question": "Command to scale a deployment names webapp to 5 replicas?", "answer": "kubectl scale deployment webapp --replicas=5"}}, {"model": "flashcards.card", "pk": 8, "fields": {"parent_card_set": 1, "question": "Command to create a ConfigMap call mycm with a key of user and a value of sysadmin?", "answer": "kubectl create cm mycm --from-literal=user=sysadmin"}}, {"model": "flashcards.card", "pk": 9, "fields": {"parent_card_set": 1, "question": "Command to list namespaces on a cluster?", "answer": "kubectl get ns"}}, {"model": "flashcards.card", "pk": 10, "fields": {"parent_card_set": 1, "question": "Command to list pods in the development namespace?", "answer": "kubectl get pods -n development"}}, {"model": "flashcards.card", "pk": 11, "fields": {"parent_card_set": 1, "question": "Command to create a pod named websrv and image httpd in the prod namespace?", "answer": "kubectl run websrv --image=httpd -n prod"}}, {"model": "flashcards.card", "pk": 12, "fields": {"parent_card_set": 1, "question": "Command to view services in all namespaces?", "answer": "kubectl get service -A"}}, {"model": "flashcards.card", "pk": 13, "fields": {"parent_card_set": 1, "question": "Command to view the TargetPort on a service called nginx-svc in default namespace?", "answer": "kubectl describe svc nginx-svc | grep TargetPort"}}, {"model": "flashcards.card", "pk": 14, "fields": {"parent_card_set": 1, "question": "Command to list the number of deployments in the default namespace?", "answer": "kubectl get deployments"}}, {"model": "flashcards.card", "pk": 15, "fields": {"parent_card_set": 1, "question": "Deploy a pod called mydb with the redis:alpine image and labels set to env=dev.", "answer": "kubectl run mydb --image=redis:alpine -l tier=db"}}, {"model": "flashcards.card", "pk": 16, "fields": {"parent_card_set": 1, "question": "Command to create a service call db-service to expose the mysql application within the cluster on port 6700?", "answer": "kubectl expose pod mysql --port=6700 --name db-service"}}, {"model": "flashcards.card", "pk": 17, "fields": {"parent_card_set": 1, "question": "Command to create a deployment called dbapp using the redis image and 2 replicas?", "answer": "kubectl create deployment dbapp --image=redis --replicas=2"}}, {"model": "flashcards.card", "pk": 18, "fields": {"parent_card_set": 1, "question": "Command to create a new namespace called development?", "answer": "kubectl create ns development"}}, {"model": "flashcards.card", "pk": 19, "fields": {"parent_card_set": 1, "question": "Command to create a pod called whizbang using the image nginx in the default namespace.", "answer": "kubectl run whizbang --image=nginx"}}, {"model": "flashcards.card", "pk": 20, "fields": {"parent_card_set": 1, "question": "Command to create a pod using the pod definition called redis.yaml?", "answer": "kubectl create -f redis.yaml"}}, {"model": "flashcards.card", "pk": 21, "fields": {"parent_card_set": 1, "question": "How do you manually schedule a pod on node1?", "answer": "Add the nodeName field under the spec section of your yaml file with node1 as the value:\r\n\r\nspec:\r\n nodeName: node1"}}, {"model": "flashcards.card", "pk": 22, "fields": {"parent_card_set": 1, "question": "Command to add label env=stage to a node called node5?", "answer": "kubectl label node node5 env=stage"}}, {"model": "flashcards.card", "pk": 23, "fields": {"parent_card_set": 1, "question": "Command to list taints on a node called node2?", "answer": "kubectl describe node node2 | grep -i taints"}}, {"model": "flashcards.card", "pk": 24, "fields": {"parent_card_set": 1, "question": "Command to list all daemonsets in all namespaces?", "answer": "kubectl get daemonsets -A"}}, {"model": "flashcards.card", "pk": 25, "fields": {"parent_card_set": 1, "question": "Command to view the number of nodes the pods scheduled by a DaemonSet called kube-ds?", "answer": "kubectl describe ds kube-ds \r\n\r\nReview section Number of Nodes Scheduled with Available Pods."}}, {"model": "flashcards.card", "pk": 26, "fields": {"parent_card_set": 1, "question": "Command to view the number of static pods in a the controlplane cluster?", "answer": "kubectl get pods\r\n\r\nLook for pods with the -controlplane suffix appended to the name."}}, {"model": "flashcards.card", "pk": 27, "fields": {"parent_card_set": 1, "question": "How do you identify the directory that holds the static pod definition files?", "answer": "1. Get the kubelet config file:\r\nps -aux | grep /usr/bin/kubelet\r\n\r\n2. Using the output from above command, review file and look for the value assigned to staticPodPath."}}, {"model": "flashcards.card", "pk": 28, "fields": {"parent_card_set": 1, "question": "Command to create a static pod called static-httpd that uses the httpd image and the command sleep 8000", "answer": "Create a pod definition file in the manifest folder by doing the following:\r\n\r\nkubectl run --restart=Never --image=httpd static-httpd --dry-run=client -o yaml --command -- sleep 8000 > /path/for/static/manifests/static-httpd.yaml"}}, {"model": "flashcards.card", "pk": 29, "fields": {"parent_card_set": 1, "question": "What command can be used to list all the running nodes and pods along with their resource utilization?", "answer": "kubectl top node"}}, {"model": "flashcards.card", "pk": 30, "fields": {"parent_card_set": 1, "question": "Command to identify the pod that consumes the most memory?", "answer": "kubectl top pod --sort-by='memory' --no-headers"}}, {"model": "flashcards.card", "pk": 31, "fields": {"parent_card_set": 1, "question": "Command to view the logs of a pod called zip?", "answer": "kubectl logs zip"}}, {"model": "flashcards.card", "pk": 32, "fields": {"parent_card_set": 1, "question": "Command to view the logs in a pod call mobile-app in container mobile-app1?", "answer": "kubectl logs mobile-app -c mobile-app1"}}, {"model": "flashcards.card", "pk": 33, "fields": {"parent_card_set": 1, "question": "Command to view of the logs for webapp deployment?", "answer": "kubectl logs deployment/webapp"}}, {"model": "flashcards.card", "pk": 34, "fields": {"parent_card_set": 1, "question": "Command to view the current strategy for a deployment called web1-prod-deploy?", "answer": "kubectl describe deploy web1-prod-deploy | grep StrategyType"}}, {"model": "flashcards.card", "pk": 35, "fields": {"parent_card_set": 1, "question": "Command to identify the db user from a ConfigMap called db-config?", "answer": "kubectl describe cm db-config"}}, {"model": "flashcards.card", "pk": 36, "fields": {"parent_card_set": 1, "question": "Command to create a ConfigMap called db-config with DB_USER=pgadmin and DB_PASSWORD=SuPeRsEcReT", "answer": "kubectl create cm db-config --from-literal=DB_USER=pgadmin --from-literal= DB_PASSWORD=SuPeRsEcReT"}}, {"model": "flashcards.card", "pk": 37, "fields": {"parent_card_set": 1, "question": "Command to list all secrets in all namespaces?", "answer": "kubectl get secrets -A"}}, {"model": "flashcards.card", "pk": 38, "fields": {"parent_card_set": 1, "question": "Command to view the secrets defined in the db-config secret?", "answer": "kubectl describe secrets db-config \r\n\r\nReview the information in the Data field."}}, {"model": "flashcards.card", "pk": 39, "fields": {"parent_card_set": 1, "question": "How do you configure a pod to load environment variables from a secret called db-secret?", "answer": "Add the secret information to the spec file for the container:\r\n\r\nenvFrom:\r\n - secretRef:\r\n name: db-secret"}}, {"model": "flashcards.card", "pk": 40, "fields": {"parent_card_set": 1, "question": "Command to create a multi-container pod with 2 containers. One container named yellow with httpd image and one named blue with redis image.", "answer": "1. kubectl run yellow --image=httpd --dry-run=client -o yaml > multi.yaml\r\n\r\n2. Edit multi.yaml and add blue with redis image.\r\n\r\n3. Apply config with: kubectl apply -f multi.yaml"}}, {"model": "flashcards.card", "pk": 41, "fields": {"parent_card_set": 1, "question": "Command to empty node1 and mark it as unscheduable?", "answer": "kubectl drain node1 --ignore-daemonsets"}}, {"model": "flashcards.card", "pk": 42, "fields": {"parent_card_set": 1, "question": "Command to configure node1 to be scheduable again?", "answer": "kubectl uncordon node1"}}, {"model": "flashcards.card", "pk": 43, "fields": {"parent_card_set": 1, "question": "Command to view the current version of the cluster?", "answer": "kubectl get nodes\r\n\r\nLook under the Version column."}}, {"model": "flashcards.card", "pk": 44, "fields": {"parent_card_set": 1, "question": "Command to see which nodes can host workloads in a cluster?", "answer": "kubectl describe nodes <nodename> | grep -i taint\r\n\r\nIf Taints: <none> then a node can host a workload."}}, {"model": "flashcards.card", "pk": 45, "fields": {"parent_card_set": 1, "question": "Command to determine the latest stable version of Kubernetes?", "answer": "kubeadm upgrade plan\r\n\r\nReview 'remote version'."}}, {"model": "flashcards.card", "pk": 46, "fields": {"parent_card_set": 1, "question": "Command to drain a worker node called node05 and mark it UnScheduable?", "answer": "kubectl drain node05 --ignore-daemonsets"}}, {"model": "flashcards.card", "pk": 47, "fields": {"parent_card_set": 1, "question": "Command to take a snapshot of the ETCD database and store it in /opt/snapshot-pre-upgrade.db?", "answer": "ETCDCTL_API=3 etcdctl --endpoints=https://[127.0.0.1]:2379 \\\r\n--cacert=/etc/kubernetes/pki/etcd/ca.crt \\\r\n--cert=/etc/kubernetes/pki/etcd/server.crt \\\r\n--key=/etc/kubernetes/pki/etcd/server.key \\\r\nsnapshot save /opt/snapshot-pre-upgrade.db"}}, {"model": "flashcards.card", "pk": 48, "fields": {"parent_card_set": 1, "question": "Command to view the Common Name configured on a etcd server certificate?", "answer": "openssl x509 -in /etc/kubernetes/pki/etcd/server.crt -text\r\n\r\nLook for Subject CN."}}, {"model": "flashcards.card", "pk": 49, "fields": {"parent_card_set": 1, "question": "What commands can you use to identify the kube-api server container and view its logs?", "answer": "1. crictl ps -a | grep kube-apiserver\r\nThis displays the container id. Then review the logs:\r\n\r\n2. crictl logs <container_id>"}}, {"model": "flashcards.card", "pk": 50, "fields": {"parent_card_set": 1, "question": "Command to generate the base64 encoded format of a csr name jamie.csr?", "answer": "cat jamie.csr | base64 -w 0"}}, {"model": "flashcards.card", "pk": 51, "fields": {"parent_card_set": 1, "question": "Command to get the status of CSRs?", "answer": "kubectl get csr"}}, {"model": "flashcards.card", "pk": 52, "fields": {"parent_card_set": 1, "question": "Command to approve a CSR called jamie?", "answer": "kubectl certificate approve jamie"}}, {"model": "flashcards.card", "pk": 53, "fields": {"parent_card_set": 1, "question": "Command to reject a certificate named john-wick?", "answer": "kubectl certificate deny john-wick"}}, {"model": "flashcards.card", "pk": 54, "fields": {"parent_card_set": 1, "question": "Command to view the number of clusters in the default kubeconfig file?", "answer": "kubectl config view"}}, {"model": "flashcards.card", "pk": 55, "fields": {"parent_card_set": 1, "question": "Command to change the current context?", "answer": "kubectl config use-context"}}, {"model": "flashcards.card", "pk": 56, "fields": {"parent_card_set": 1, "question": "Command to list service accounts in the default namespace?", "answer": "kubectl get sa"}}, {"model": "flashcards.card", "pk": 57, "fields": {"parent_card_set": 1, "question": "Command to create a service account called webapp-sa?", "answer": "kubectl create sa webapp-sa"}}, {"model": "flashcards.card", "pk": 58, "fields": {"parent_card_set": 1, "question": "How to edit a pod and change the user ID to 1001?", "answer": "Edit the pod manifest and add the following to the spec section:\r\n\r\nsecurityContext:\r\n runAsUser: 1010"}}, {"model": "flashcards.card", "pk": 59, "fields": {"parent_card_set": 1, "question": "Command to change the myapp pod to run as the root user with the SYS_TIME capability?", "answer": "Edit the manifest file for myapp and add the following under the spec containers section:\r\n\r\nsecurityContext:\r\n capabilities:\r\n add: [\"SYS_TIME\"]"}}, {"model": "flashcards.card", "pk": 60, "fields": {"parent_card_set": 1, "question": "Command to list network policies?", "answer": "kubectl get netpol"}}, {"model": "flashcards.card", "pk": 61, "fields": {"parent_card_set": 1, "question": "Command to view which pod a network policy is applied to?", "answer": "1. kubectl get netpol\r\n\r\n2. Review the labels under pod-selector and then run:\r\nkubectl get po --show-labels | grep <label>=<name>"}}, {"model": "flashcards.card", "pk": 62, "fields": {"parent_card_set": 1, "question": "Command to determine what type of traffic a network policy is configured for?", "answer": "kubectl describe netpol\r\n\r\nReview type under Policy Types."}}, {"model": "flashcards.card", "pk": 63, "fields": {"parent_card_set": 1, "question": "Command to delete a pod called mypod?", "answer": "kubectl delete pod mypod"}}, {"model": "flashcards.card", "pk": 64, "fields": {"parent_card_set": 1, "question": "Command to view the status of a persistent volume claim?", "answer": "kubectl get pvc"}}, {"model": "flashcards.card", "pk": 65, "fields": {"parent_card_set": 1, "question": "Command to delete a PVC called my-claim?", "answer": "kubectl delete pvc my-claim"}}, {"model": "flashcards.card", "pk": 66, "fields": {"parent_card_set": 1, "question": "Command to view storage classes in a cluster?", "answer": "kubectl get sc"}}]