You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 

45 lines
1.3 KiB

---
#- name: Intilizing Kubernetes Cluster
# command: kubeadm init --pod-network-cidr 192.168.0.0/16 --apiserver-advertise-address "{{ k8s_master_ip }}"
# run_once: true
# delegate_to: "{{ k8s_master_ip }}"
- name: Create directory for kube config.
file:
path: /home/fedy95/.kube
state: directory
owner: "fedy95"
group: "fedy95"
mode: 0755
- name: Copy /etc/kubernetes/admin.conf to user home directory /home/fedy95/.kube/config.
copy:
src: /etc/kubernetes/admin.conf
dest: /home/fedy95/.kube/config
remote_src: yes
owner: "fedy95"
group: "fedy95"
mode: '0644'
- name: Remove the cache directory.
file:
path: /home/fedy95/.kube/cache
state: absent
- name: Create Pod Network & RBAC.
command: "{{ item }}"
with_items:
- kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
- kubectl create -f https://docs.projectcalico.org/manifests/custom-resources.yaml
- name: Get the token for joining the nodes with Kuberentes master.
shell: kubeadm token create --print-join-command
register: kubernetes_join_command
- debug:
msg: "{{ kubernetes_join_command.stdout }}"
- name: Copy join command to local file.
become: false
local_action: copy content="{{ kubernetes_join_command.stdout_lines[0] }}" dest="/tmp/kubernetes_join_command" mode=0777
...