Skip to content

Commit 29ea64e

Browse files
author
Felipe Grings
committed
Update env to run on Local VMs
1 parent 683dffc commit 29ea64e

File tree

13 files changed

+45
-14
lines changed

13 files changed

+45
-14
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.swp
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ansible_ssh_private_key_file: "../terraform-prov-aws/K8S-DEMO-key.pem"
1+
#ansible_ssh_private_key_file: "../terraform-prov-aws/K8S-DEMO-key.pem"
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[tag_Role_master]
2+
200.137.215.86
3+
4+
[tag_Role_worker]
5+
200.137.215.87
6+
200.137.215.88
7+
200.137.215.89
8+
9+
[all:vars]
10+
ansible_port=42112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ansible-playbook -u ${1:-default-user} -i hosts site.yml ${@:2}

infra/aws-tform-e2e/ansible-free5gc/site.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- name: Install k8s and docker packages
22
become: yes
3-
hosts: tag_Type_k8s
3+
hosts: all
44
roles:
55
- k8s-all
66

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
21
# K8S Single Cluster spinup
32
This is a project willing to summarize some of the DevOps topics.
43
## Used Tools
54
The main idea was to use as much tools as I could:
65

7-
- Docker
86
- Ansible
9-
- Terraform
10-
- Drone CI
117
- AWS
128
- Kubernetes
139

1410
## How does it work?
1511

16-
- Terraform creates the 3 AWS instances, Security Group and a Keypair.
17-
- Ansible installs and configure Kubernetes.
18-
- They work together on a Drone CI pipeline.
19-
- The Drone CI uses a Docker container that I have created with Terraform and Ansible there.
12+
- Ansible installs and configure Kubernetes over AWS env or local VMs env.
2013

2114
## The goal
22-
The goal is just to setup a Kubernetes cluster within 3 AWS instances.
15+
The goal is just to setup a Kubernetes cluster within instances.
16+
17+
## Run Local
18+
Update variables ansible-k8s-KEY.perm @ groups_vars/all.yaml
19+
Run the script run-local.sh
20+
21+
## If nodes not connecting run
22+
23+
```bash
24+
kubeadm join --token b0f7b8.8d1767876297d85c \
25+
--discovery-token-unsafe-skip-ca-verification \
26+
200.137.215.86:6443
27+
```

infra/aws-tform-e2e/ansible-k8s/group_vars/all.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ kubeadm_opts: ""
77

88
master_ip: "{{ hostvars[groups['tag_Role_master'][0]]['ansible_default_ipv4'].address | default(groups['tag_Role_master'][0]) }}"
99

10-
ansible_ssh_private_key_file: "../terraform-prov-aws/K8S-DEMO-key.pem"
10+
#ansible_ssh_private_key_file: "../terraform-prov-aws/K8S-DEMO-key.pem"

infra/aws-tform-e2e/ansible-k8s/hosts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[tag_Role_master]
2+
200.137.215.86
3+
4+
[tag_Role_worker]
5+
200.137.215.87
6+
200.137.215.88
7+
200.137.215.89
8+
9+
[all:vars]
10+
ansible_port=42112

infra/aws-tform-e2e/ansible-k8s/roles/k8s-master/tasks/main.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# rm -r ~/.kube/
55

66
- name: Initialize k8s cluster
7+
tags: init
78
command:
89
kubeadm init --service-cidr {{ service_cidr }} \
910
--pod-network-cidr {{ pod_network_cidr }} \
@@ -20,6 +21,6 @@
2021
KUBECONFIG: "/etc/kubernetes/admin.conf"
2122

2223
- name: Install Ingress pod
23-
shell: kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/f0f9b5262b993c4800726cb5d59f6da3b8a3dc4e/Documentation/kube-flannel.yml
24+
shell: kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.2/deploy/static/provider/cloud/deploy.yaml
2425
environment:
2526
KUBECONFIG: "/etc/kubernetes/admin.conf"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ansible-playbook -u ${1:-default-user} -i hosts site.yml ${@:2}

infra/aws-tform-e2e/ansible-k8s/site.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- name: Install k8s and docker packages
22
become: yes
3-
hosts: tag_Type_k8s
3+
hosts: all
44
roles:
55
- docker
66
- k8s-all

infra/passwd.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
U$XqlXM8Rfs8!UR0
2+

0 commit comments

Comments
 (0)