Question 91

Given a container that writes a log file in format A and a container that converts log files from format A to format B, create a deployment that runs both containers such that the log files from the first container are converted by the second container, emitting logs in format B.
Task:
* Create a deployment named deployment-xyz in the default namespace, that:
*Includes a primary
lfccncf/busybox:1 container, named logger-dev
*includes a sidecar Ifccncf/fluentd:v0.12 container, named adapter-zen
*Mounts a shared volume /tmp/log on both containers, which does not persist when the pod is deleted
*Instructs the logger-dev
container to run the command

which should output logs to /tmp/log/input.log in plain text format, with example values:

* The adapter-zen sidecar container should read /tmp/log/input.log and output the data to /tmp/log/output.* in Fluentd JSON format. Note that no knowledge of Fluentd is required to complete this task: all you will need to achieve this is to create the ConfigMap from the spec file provided at /opt/KDMC00102/fluentd-configma p.yaml , and mount that ConfigMap to /fluentd/etc in the adapter-zen sidecar container See the solution below.
Question 92
You are building a container image for a Spring Boot application that connects to a MySQL database. The application requires specific environment variables, such as the database nostname, username, password, and port. How would you define these environment variables Within the Docker-file to ensure the application runs correctly in a Kubernetes cluster?
Question 93
You have a Deployment named 'database-deployment' that runs a PostgreSQL database container. You want to enforce the following security restrictions:
- The container should only be allowed to run with the I-IID 1000.
- The container should be able to access a specific hostPath volume mounted at '/db-data' for storing database data.
- The container should not be allowed to escalate privileges.
- The container should only have the 'NET BIND SERVICE capability, allowing it to listen on specific ports.
You need to define a SecurityContext in the Deployment configuration to enforce these restrictions.
- The container should only be allowed to run with the I-IID 1000.
- The container should be able to access a specific hostPath volume mounted at '/db-data' for storing database data.
- The container should not be allowed to escalate privileges.
- The container should only have the 'NET BIND SERVICE capability, allowing it to listen on specific ports.
You need to define a SecurityContext in the Deployment configuration to enforce these restrictions.
Question 94
You have a web application that uses two different services: 'frontend' and 'backend'. You want to restrict access to the 'backend' service from all pods except those with the label 'app: frontend'. How would you configure NetworkPolicy to achieve this?
Question 95

Task
A Deployment named backend-deployment in namespace staging runs a web application on port 8081.














