LCA Cloud Integration & Deployment 4 — Questions and Answers
Question 1: What command exports a Docker image as a tar archive that can be transferred to another host?
- docker commit mycontainer image.tar
- docker save myimage -o image.tar (Correct answer)
- docker export myimage > image.tar
- docker push myimage image.tar
Correct answer: docker save myimage -o image.tar
'docker save' exports one or more images to a tar archive, preserving layers and metadata for later import with 'docker load'.
Question 2: In Terraform, what is the purpose of the 'terraform.tfstate' file?
- It stores provider API credentials for authentication
- It records the current state of managed infrastructure resources (Correct answer)
- It defines variable default values for modules
- It contains the execution plan before applying changes
Correct answer: It records the current state of managed infrastructure resources
The terraform.tfstate file records the current state of all resources managed by Terraform, enabling it to detect drift and plan incremental changes.
Question 3: Which cloud-init directive is used to run shell commands during the first boot of a cloud instance?
- #cloud-config with 'packages'
- #cloud-config with 'runcmd' (Correct answer)
- #cloud-config with 'write_files'
- #cloud-config with 'bootcmd'
Correct answer: #cloud-config with 'runcmd'
The 'runcmd' directive in cloud-init user data runs a list of commands once during the final stage of the first boot.
Question 4: What does the 'kubectl get pods -n kube-system' command do?
- Lists all pods across every namespace in the cluster
- Lists pods running in the kube-system namespace (Correct answer)
- Shows the system resource usage of all pods
- Filters pods by the label 'system=kube'
Correct answer: Lists pods running in the kube-system namespace
The '-n kube-system' flag scopes the query to the kube-system namespace, which contains core cluster components like CoreDNS and kube-proxy.
Question 5: Which Docker networking driver allows containers on different hosts to communicate as if on the same network?
- bridge
- host
- overlay (Correct answer)
- macvlan
Correct answer: overlay
The overlay network driver creates a distributed network spanning multiple Docker daemons, enabling containers on different hosts to communicate securely.
Question 6: What is the purpose of a Kubernetes Namespace?
- To define DNS search domains for pods
- To partition cluster resources among multiple users or teams (Correct answer)
- To set resource quotas per container
- To create isolated network segments between nodes
Correct answer: To partition cluster resources among multiple users or teams
Namespaces provide a mechanism to partition a single Kubernetes cluster into multiple virtual clusters, enabling resource isolation between teams or environments.
Question 7: Which command shows the logs of a container running in a Kubernetes pod named 'webserver'?
- kubectl describe pod webserver
- kubectl logs pod/webserver (Correct answer)
- kubectl exec webserver -- journalctl
- kubectl get events --pod=webserver
Correct answer: kubectl logs pod/webserver
'kubectl logs pod/webserver' streams the stdout/stderr of the container running in the specified pod.
What command exports a Docker image as a tar archive that can be transferred to another host?