G

INT-23487

public
Guest Oct 29, 2024 9 hours 14
Clone
Plaintext Devops -TAS 44 lines (36 loc) | 1.94 KB
1
Objective
2
Create a scalable and highly available containerized web application deployment using Terraform, Ansible, and a self-managed Kubernetes cluster on AWS. This exercise tests your ability to:
3
4
Provision infrastructure as code using Terraform.
5
Automate configuration management with Ansible.
6
Set up and manage a Kubernetes cluster on virtual machines.
7
Deploy applications using Kubernetes.
8
Apply security best practices with appropriate IAM policies.
9
Task Overview
10
1. Infrastructure Provisioning with Terraform
11
Use Terraform to provision the following AWS resources:
12
13
VPC and Networking:
14
15
A VPC with public and private subnets spread across two availability zones.
16
An Internet Gateway and appropriate Route Tables for public subnets.
17
NAT Gateways for private subnet internet access.
18
Compute Resources:
19
20
Three EC2 instances:
21
One master node for Kubernetes control plane.
22
Two worker nodes for running containerized applications.
23
Instances should be in private subnets for security.
24
Security Groups and IAM Roles:
25
26
Security groups to control access:
27
Allow SSH access from your IP to the master node.
28
Allow Kubernetes communication between nodes.
29
IAM roles and policies for EC2 instances as needed.
30
2. Configuration Management with Ansible
31
Use Ansible to perform the following:
32
33
Set Up Kubernetes Cluster:
34
35
Install necessary dependencies (Docker, kubeadm, kubelet, kubectl) on all nodes.
36
Initialize the Kubernetes control plane on the master node using kubeadm.
37
Join the worker nodes to the cluster.
38
Deploy a Sample Application:
39
40
Use Ansible to deploy a containerized web application (e.g., NGINX or a custom Docker image) to the Kubernetes cluster.
41
Expose the application via a Kubernetes Service of type NodePort or LoadBalancer (using an external load balancer if preferred).
42
3. Testing and Validation
43
Access the application's endpoint to verify it is running correctly.
44
Scale the deployment to multiple replicas and observe the changes.