1. We have a pod that has two containers, the pod is in unhealthy state. What should we do to learn more about the issue?

Answer : Option C (Check the logs using kubectl logs and the -c flag, specifying each container.)

Explanation :

When pods are unhealthy first we analyze the logs from container to identity root cause of issue. the “kubectl logs” command itself retrieve log from container of pod. Since we have two container using kubectl logs alone wouldn't provide complete info to examine logs of each container individually , you need the -c flag with specific container name .

  1. Write the kubectl command that returns this output. Command : kubectl get pods

  2. Some of our team members are debating whether we should use a single AWS load balancer for all of our microservices or use a load balancer per microservice. Give you opinion and explain your approach.

Answer :

i will go fir single ALB for cost effectiveness , simpler management and built-in scaling. Implement path based routing with ALB to direct traffic to specific microservices based on URL paths.

then configure ALB for high availability by deploying it across multiple availability zones. then utilize feature like health checks and target group within ALB to monitor the health of microservices. But if i have large number of microservices managing a single ALB complete path based routing might become complicated in such case i will use service like AWS app mesh to manage traffic routing

Terraform

  1. We would like to deploy two ec2 instances into two different AWS regions use the same terraform code. Write the terraform code that fulfil the bellow requirements.

folder structure :