-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
408c437
commit 1afb486
Showing
13 changed files
with
236 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: v1 | ||
clusters: | ||
- cluster: | ||
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUREekNDQWZlZ0F3SUJBZ0lVRUlPNGQ2T1BkMUdHNFBQOWRmU3lHM0JwNkZVd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0Z6RVZNQk1HQTFVRUF3d01NVEF1TVRVeUxqRTRNeTR4TUI0WERUSXlNVEF4TURFM05USXpNMW9YRFRNeQpNVEF3TnpFM05USXpNMW93RnpFVk1CTUdBMVVFQXd3TU1UQXVNVFV5TGpFNE15NHhNSUlCSWpBTkJna3Foa2lHCjl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF2V3NLVDk0Y09OZ0RmS0hpbytsSUNQY1A2UlFTM0VoUHFQOGkKOFhkV0g0OWt1MjloRGNVMlEyUWdLVU1KTGY1RjBWOEZpY2F5RitwVFpVOVVzR0VpSU1VS1lrb1JNSWxBM0VpSApKWlpKa1k2Y0ZJYjZxY3NiR1k1WGtxcWVyTmorM1UvWnQvV0ZDTXNnY1pwTFRNeE9ieGs3OHpmYkM3YmliL3ZQCnI5VDhTRDU0Vm5YdE9kUzB3RmFXZUU2bXQxTyt6Qk0zUllNd3BqRVhzaUxjYk1EZXdoVW9PZ1gvRklqVjFGQS8KdGhIeFRvaWV5L1E4R1N6RjRVTUtyQW02VlZTdmYvV2J0VU83M0VXOVI1NGNtRDNHT3VOaHA0c1VPYThYK2MvdQprdktIbEdXVVc0cit0RUZZaTA0RlFmdHEycGtzN3BmQllFY2ZNTlZvWHIyeGk2blRpd0lEQVFBQm8xTXdVVEFkCkJnTlZIUTRFRmdRVUFaWFpQLzlVeFZmZ2x0UjRvQitSVC92M1NGZ3dId1lEVlIwakJCZ3dGb0FVQVpYWlAvOVUKeFZmZ2x0UjRvQitSVC92M1NGZ3dEd1lEVlIwVEFRSC9CQVV3QXdFQi96QU5CZ2txaGtpRzl3MEJBUXNGQUFPQwpBUUVBSjRFck1ZUXhjalp4Q0lVWUNYcks3ODVZaVBlb0t3M3IvQi94QjBnWHFRK0xrTE84SnFWZXMyd0lVTWxoCm9vMXhsRWowWUtVUmdVL0pkWWZuRjJ6ejg1QXBuOHVrTUh2MmYxTHE5c0lYclJ3WGR1b2hnaEVwc01ld3QxRHQKdFZaTGQ4WTFNaFpEMmplS2JJT2FEeEdQK1ZaL0dHeUhFOURvS0FydWdMTHVXTnhHTzlXdVc1bkVtSVBIWVRjUwpHdWJqUUNjWDlKNE5udVk3NDBoZ0U2ZGw1R2tZcWVadUtvZlNzVEhWYzNtS2N6TmFaQmV0ZXJJSXNUZ2VuVUdnCmZaUXkzeXc0NVdQMU5lQWVIQkNaNXdIQ2FzYWJpQ1g3TTZiSG44OHp6dXR5MUFRVlI4K1dLaUNqbHVqTGwvYm4KN0gzN3ZBWHdwMkVId1dla3NodjNlT2U4ZkE9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== | ||
server: https://10.0.0.11:16443 | ||
name: microk8s-cluster | ||
contexts: | ||
- context: | ||
cluster: microk8s-cluster | ||
user: admin | ||
name: microk8s | ||
current-context: microk8s | ||
kind: Config | ||
preferences: {} | ||
users: | ||
- name: admin | ||
user: | ||
token: Zjl2NXBpUVlvRVA3SUV5UFdXa1hqSGZ0cDl0RDJjN3B4cWRwSVp3a2FmOD0K | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
|
||
- name: Initialising cluster | ||
hosts: nodes | ||
become: yes | ||
tasks: | ||
- name: Updating instances | ||
apt: | ||
update_cache: yes | ||
upgrade: dist | ||
|
||
- name: Rebooting instances | ||
reboot: | ||
|
||
- name: Updating snaps | ||
shell: snap refresh | ||
|
||
- name: Rebooting instances | ||
reboot: | ||
|
||
- name: Installing microk8s | ||
command: snap install microk8s --classic --channel=latest/stable | ||
|
||
- name: Waiting for microk8s to start | ||
command: microk8s status --wait-ready | ||
|
||
|
||
- name: Configuring Master node | ||
hosts: ocarm1 | ||
become: yes | ||
tasks: | ||
- name: Enable ingress addon | ||
command: microk8s enable ingress | ||
|
||
- name: Add DNS record | ||
shell: "echo {{ hostvars['ocarm2']['private_ip'] }} ocarm2 | tee -a /etc/hosts" | ||
|
||
- name: Copying worker node token | ||
shell: microk8s add-node --format=short | grep -m 1 "microk8s.*" | ||
register: nodetoken | ||
|
||
- name: Store worker node token | ||
set_fact: | ||
token: "{{ nodetoken.stdout }}" | ||
|
||
|
||
- name: Configuring Worker node | ||
hosts: ocarm2 | ||
become: yes | ||
tasks: | ||
- name: Add DNS record | ||
shell: "echo {{ hostvars['ocarm1']['private_ip'] }} ocarm1 | tee -a /etc/hosts" | ||
|
||
- name: Joining cluster | ||
command: "{{ hostvars['ocarm1']['token'] }} --worker" | ||
|
||
|
||
- name: Finalising | ||
hosts: ocarm1 | ||
become: yes | ||
tasks: | ||
- name: Sleep for 10 seconds | ||
ansible.builtin.wait_for: | ||
timeout: 10 | ||
|
||
- name: Adding role to master node | ||
command: microk8s kubectl label node ocarm1 kubernetes.io/role=master | ||
|
||
- name: Adding role to worker node | ||
command: microk8s kubectl label node ocarm2 kubernetes.io/role=worker | ||
|
||
- name: Generating kube config file | ||
shell: microk8s config > /tmp/kubeconfig | ||
|
||
- name: Fetching kube config file for local kubectl access | ||
fetch: | ||
src: /tmp/kubeconfig | ||
dest: ../kubeconfig | ||
flat: yes | ||
|
||
- name: Linking Control Plane IP to DuckDNS | ||
uri: | ||
url: "{{ kube_duckdns_url }}" | ||
|
||
- name: Rebooting | ||
hosts: nodes | ||
become: yes | ||
tasks: | ||
- name: Rebooting instances | ||
reboot: |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
provider "oci" { | ||
|
||
config_file_profile= var.config_file_profile | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
[homelab] | ||
${ocarm1_name} ansible_host=${ocarm1_ip} | ||
${ocarm2_name} ansible_host=${ocarm2_ip} | ||
[nodes] | ||
${ocarm1_name} ansible_host=${ocarm1_ip} private_ip=${ocarm1_private_ip} | ||
${ocarm2_name} ansible_host=${ocarm2_ip} private_ip=${ocarm2_private_ip} | ||
|
||
[homelab:vars] | ||
[registry] | ||
${ocamd1_name} ansible_host=${ocamd1_ip} private_ip=${ocamd1_private_ip} | ||
|
||
[kubernetes:children] | ||
nodes | ||
registry | ||
|
||
[kubernetes:vars] | ||
ansible_user=ubuntu | ||
ansible_ssh_private_key_file=${ansible_ssh_private_key_file} | ||
duckdns_url=${duckdns_url} | ||
kube_duckdns_url=${kube_duckdns_url} | ||
registry_duckdns_url=${registry_duckdns_url} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
ssh_authorized_keys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINdAjFIVuEXPP+mUqyKcLV/eA7A9jjGvkKA8ZFp2xNXz sol@sol-PC" | ||
region = "us-phoenix-1" | ||
ampere_source_image_id = "ocid1.image.oc1.phx.aaaaaaaamtniveyy275y6d3hm37exftu76e2l7pdqhmpcuw6ean2xy44zywa" | ||
region = "ap-hyderabad-1" | ||
ampere_source_image_id = "ocid1.image.oc1.ap-hyderabad-1.aaaaaaaatrcrz26pphlblpduppycd2mkazocye7epuu5vxnuvf7wch43r6fa" | ||
amd_source_image_id = "ocid1.image.oc1.ap-hyderabad-1.aaaaaaaaammbtmhmaozuu7gqqlyz3zftzfnvamc5n3paxv4qpyynf5obwzsa" | ||
ampere_boot_volume_size = 70 | ||
amd_boot_volume_size = 50 | ||
ansible_ssh_private_key_file = "/home/sol/.ssh/root@oracle" | ||
config_file_profile = "INDIA" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.