LCA Cloud Integration & Deployment 5 — Questions and Answers
Question 1: What is the primary purpose of a Kubernetes PersistentVolumeClaim (PVC)?
- To define storage class policies for cluster administrators
- To request specific storage resources that a pod can use (Correct answer)
- To back up pod data to an external cloud provider
- To replicate volumes across multiple availability zones
Correct answer: To request specific storage resources that a pod can use
A PVC is a user's request for storage that Kubernetes binds to an available PersistentVolume matching the specified size and access mode.
Question 2: Which systemd unit type is best suited for running a containerized application that should restart automatically on failure?
- oneshot
- forking
- simple (Correct answer)
- notify
Correct answer: simple
A 'simple' systemd service type is appropriate for long-running processes like containers, and combined with 'Restart=always' ensures automatic restarts on failure.
Question 3: In a GitLab CI/CD pipeline, what does the 'only: - main' directive control?
- The job runs only when the main branch is deleted
- The job runs only when changes are pushed to the main branch (Correct answer)
- The job runs only for merge requests targeting main
- The job runs only if the pipeline was triggered manually on main
Correct answer: The job runs only when changes are pushed to the main branch
The 'only: - main' directive restricts the job to execute only when commits are pushed to the branch named 'main'.
Question 4: Which command removes all stopped containers, unused networks, dangling images, and build cache from a Docker host?
- docker rm -f $(docker ps -aq)
- docker system prune (Correct answer)
- docker image prune -a
- docker container prune --volumes
Correct answer: docker system prune
'docker system prune' removes all stopped containers, unused networks, dangling images, and the build cache in a single command.
Question 5: What is the function of an AWS Security Group in a cloud deployment?
- It encrypts data at rest for EC2 instance volumes
- It acts as a stateful virtual firewall controlling inbound and outbound traffic (Correct answer)
- It defines IAM permissions for EC2 instance profiles
- It monitors and logs all API calls made within the AWS account
Correct answer: It acts as a stateful virtual firewall controlling inbound and outbound traffic
An AWS Security Group is a stateful virtual firewall that controls inbound and outbound traffic to EC2 instances based on configurable rules.
Question 6: Which Kubernetes resource is used to store sensitive data such as passwords, tokens, or TLS certificates?
- ConfigMap
- ServiceAccount
- Secret (Correct answer)
- ResourceQuota
Correct answer: Secret
Kubernetes Secrets store sensitive data in base64-encoded form and can be mounted into pods as volumes or exposed as environment variables.
Question 7: What is the purpose of the 'EXPOSE' instruction in a Dockerfile?
- It automatically publishes the port to the host when the container runs
- It documents which ports the container listens on at runtime (Correct answer)
- It configures the host firewall to allow traffic on that port
- It binds the container port to a random available host port
Correct answer: It documents which ports the container listens on at runtime
The EXPOSE instruction documents the intended network ports, serving as metadata; actual port publishing requires '-p' in the docker run command.
What is the primary purpose of a Kubernetes PersistentVolumeClaim (PVC)?