Commit
This commit is contained in:
0
ksetup/Exported/kubeconfig.conf
Normal file
0
ksetup/Exported/kubeconfig.conf
Normal file
@ -1,7 +1,7 @@
|
||||
# Author: Oriol Filter
|
||||
# 11/03/2023
|
||||
# 30/07/2023
|
||||
# Intended for armbian (bullseye, fuck ubuntu tho) it's aarch64
|
||||
# Maybe still works for orangepi "official" versions, but I don't care about them unless I used soooooo... gl!
|
||||
# Maybe still works for orangepi "official" versions, but I only care of make it work for myself soooooo... gl!
|
||||
# https://medium.com/karlmax-berlin/how-to-install-kubernetes-on-raspberry-pi-53b4ce300b58
|
||||
- name: Preparethings
|
||||
order: inventory
|
||||
@ -19,30 +19,29 @@
|
||||
# is_master: Figurative
|
||||
|
||||
# Cluster shit
|
||||
kubeadm_join_path: "./kubeadm-join.command"
|
||||
kubeadm_join_path: "./Exported/kubeadm-join.command"
|
||||
_kubeadm_join_command: "" #placeholder
|
||||
|
||||
|
||||
tasks:
|
||||
## - check vars
|
||||
# - debug: var=set_hostname
|
||||
# - debug: var=is_master
|
||||
#
|
||||
## Init / Basic setup
|
||||
# - name: set up node
|
||||
# import_tasks: tasks_prepare_node.yaml
|
||||
# become: true
|
||||
# - check vars
|
||||
- debug: var=set_hostname
|
||||
- debug: var=is_master
|
||||
|
||||
# Init / Basic setup
|
||||
- name: set up node
|
||||
import_tasks: tasks_prepare_node.yaml
|
||||
become: true
|
||||
|
||||
# If is_master: init
|
||||
- name: init cluster
|
||||
import_tasks: tasks_master.yaml
|
||||
when: is_master
|
||||
#
|
||||
## else: join
|
||||
# - name: join cluster
|
||||
# import_tasks: tasks_slave.yaml
|
||||
# when: not is_master
|
||||
#
|
||||
## Do other stuff
|
||||
# - name: post setup
|
||||
# import_tasks: tasks_end.yaml
|
||||
|
||||
# else: join
|
||||
- name: join cluster
|
||||
import_tasks: tasks_slave.yaml
|
||||
when: not is_master
|
||||
|
||||
# Do other stuff
|
||||
- name: post setup
|
||||
import_tasks: tasks_end.yaml
|
||||
|
@ -1,3 +1,10 @@
|
||||
- name: Delete user
|
||||
ansible.builtin.user:
|
||||
name: "{{ delete_user_name }}"
|
||||
remove: true
|
||||
state: absent
|
||||
when: not is_master
|
||||
become: true
|
||||
|
||||
#reboot
|
||||
- name: reboot
|
||||
|
@ -1,9 +1,10 @@
|
||||
## Init
|
||||
#- name: Init cluster
|
||||
# ansible.builtin.command: "kubeadm init"
|
||||
# become: true
|
||||
- name: Init cluster
|
||||
ansible.builtin.command: "kubeadm init"
|
||||
become: true
|
||||
|
||||
### get kubectl file
|
||||
|
||||
## Export kubeconfig file
|
||||
|
||||
- name: Export remote kubeconfig file
|
||||
ansible.builtin.fetch:
|
||||
@ -13,6 +14,12 @@
|
||||
become: true
|
||||
|
||||
|
||||
## Taints
|
||||
|
||||
### Schedule pods on master
|
||||
- name: Remove Taint (allows deployment in control plane node)
|
||||
ansible.builtin.shell: "kubectl taint nodes --all node-role.kubernetes.io/control-plane-"
|
||||
|
||||
## CNI
|
||||
|
||||
### Calico
|
||||
@ -26,59 +33,19 @@
|
||||
ansible.builtin.command: "kubectl create --kubeconfig /etc/kubernetes/admin.conf -f https://raw.githubusercontent.com/metallb/metallb/v0.13.10/config/manifests/metallb-native.yaml"
|
||||
become: true
|
||||
|
||||
#- name: Calico custom
|
||||
# ansible.builtin.command: "kubectl create --kubeconfig /etc/kubernetes/admin.conf -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/custom-resources.yaml"
|
||||
# become: true
|
||||
## Export join command
|
||||
- name: Generate join token
|
||||
shell: kubeadm token create --print-join-command
|
||||
register: kubeadm_join_cmd
|
||||
|
||||
- set_fact:
|
||||
kubeadm_join_command: "{{ kubeadm_join_cmd.stdout }}"
|
||||
|
||||
- debug: var=kubeadm_join_command
|
||||
|
||||
## Set kubectl tool
|
||||
#- user:
|
||||
# name: "{{ ansible_user_id }}"
|
||||
# state: present
|
||||
# register: user_info_registered
|
||||
|
||||
#- name: create .kube directory
|
||||
# become: yes
|
||||
# become_user: "{{ ansible_user_id }}"
|
||||
# file:
|
||||
# path: "{{ user_info_registered.home }}/.kube"
|
||||
# state: directory
|
||||
# mode: 0755
|
||||
|
||||
#- debug: var=user_info_registered.home
|
||||
|
||||
#- name: copy admin.conf to user's kube config
|
||||
# copy:
|
||||
# src: /etc/kubernetes/admin.conf
|
||||
# remote_src: yes
|
||||
# dest: "{{ user_info_registered.home }}/.kube/config"
|
||||
# owner: "{{ ansible_user_id }}"
|
||||
# become: true
|
||||
|
||||
|
||||
## Network Plugin
|
||||
#- name: Calico
|
||||
# ansible.builtin.command: "kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/calico.yaml"
|
||||
#
|
||||
## Remove taints
|
||||
#- name: Remove Taint (allows deployment in control plane)
|
||||
# ansible.builtin.shell: "kubectl taint nodes --all node-role.kubernetes.io/control-plane-"
|
||||
#
|
||||
## Join token / command
|
||||
#- name: Generate join token
|
||||
# shell: kubeadm token create --print-join-command
|
||||
# register: kubeadm_join_cmd
|
||||
#
|
||||
#- set_fact:
|
||||
# kubeadm_join_command: "{{ kubeadm_join_cmd.stdout }}"
|
||||
#
|
||||
#- debug: var=kubeadm_join_command
|
||||
#
|
||||
#- name: Store join command in "{{ kubeadm_join_path }}"
|
||||
# copy:
|
||||
# dest: "{{ kubeadm_join_path }}"
|
||||
# content: |
|
||||
# {{ kubeadm_join_command }}
|
||||
# delegate_to: localhost
|
||||
|
||||
- name: Store join command in "{{ kubeadm_join_path }}"
|
||||
copy:
|
||||
dest: "{{ kubeadm_join_path }}"
|
||||
content: |
|
||||
{{ kubeadm_join_command }}
|
||||
delegate_to: localhost
|
||||
|
Reference in New Issue
Block a user