Skip to content

Commit c000fc7

Browse files
committed
added tf labs
1 parent 29ea8da commit c000fc7

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

kubernetes/12.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Deploy Highly Available Pods with ReplicationController
2+
3+
The Nautilus DevOps team is establishing a ReplicationController to deploy multiple pods for hosting applications that require a highly available infrastructure. Follow the specifications below to create the ReplicationController:
4+
5+
- Create a ReplicationController using the `httpd` image with `latest` tag, and name it `httpd-replicationcontroller`.
6+
- Assign labels `app` as `httpd_app`, and `type` as `front-end`. Ensure the container is named `httpd-container` and set the `replica count` to `3`.
7+
8+
All pods should be running state post-deployment.
9+
10+
> Note: The kubectl utility on jump_host is configured to operate with the Kubernetes cluster.
11+
12+
## Steps
13+
14+
1. Create a replicaton controller yaml file `rc-k3s.yml` using this [contents](./replication-controller.yml)
15+
2. Create the replication controller
16+
17+
```sh
18+
kubectl apply -f rc-k3s.yml
19+
```
20+
21+
3. Verify
22+
23+
```sh
24+
kubectl get rc
25+
kubectl get pods
26+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: ReplicationController
3+
metadata:
4+
name: httpd-replicationcontroller
5+
labels:
6+
app: httpd_app
7+
type: front-end
8+
spec:
9+
replicas: 3
10+
selector:
11+
app: httpd_app
12+
template:
13+
metadata:
14+
name: httpd-replicationcontroller
15+
labels:
16+
app: httpd_app
17+
type: front-end
18+
spec:
19+
containers:
20+
- name: httpd-container
21+
image: httpd:latest
22+
ports:
23+
- containerPort: 80

terraform/problems/01.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Create Key Pair Using Terraform
2+
3+
The Nautilus DevOps team is strategizing the migration of a portion of their infrastructure to the AWS cloud. Recognizing the scale of this undertaking, they have opted to approach the migration in incremental steps rather than as a single massive transition. To achieve this, they have segmented large tasks into smaller, more manageable units. This granular approach enables the team to execute the migration in gradual phases, ensuring smoother implementation and minimizing disruption to ongoing operations. By breaking down the migration into smaller tasks, the Nautilus DevOps team can systematically progress through each stage, allowing for better control, risk mitigation, and optimization of resources throughout the migration process.
4+
5+
For this task, create a key pair using Terraform with the following requirements:
6+
7+
- Name of the key pair should be devops-kp.
8+
9+
- Key pair type must be rsa.
10+
11+
- The private key file should be saved under /home/bob/devops-kp.pem.
12+
13+
The Terraform working directory is /home/bob/terraform. Create the main.tf file (do not create a different .tf file) to accomplish this task.
14+
15+
> Note: Right-click under the EXPLORER section in VS Code and select Open in Integrated Terminal to launch the terminal.
16+
17+
## Steps
18+
19+
```terraform
20+
resource "tls_private_key" "devops_key" {
21+
algorithm = "RSA"
22+
rsa_bits = 2048
23+
}
24+
25+
resource "aws_key_pair" "devops_kp" {
26+
key_name = "devops-kp"
27+
public_key = tls_private_key.devops_key.public_key_openssh
28+
}
29+
30+
resource "local_file" "private_key" {
31+
content = tls_private_key.devops_key.private_key_pem
32+
filename = "/home/bob/devops-kp.pem"
33+
file_permission = "0400"
34+
}
35+
```

0 commit comments

Comments
 (0)