geerlingguy/ansible-role-kubernetes

Failed to add node to the cluster

vinodhum opened this issue · 1 comments

Hi, I am getting below error

TASK [geerlingguy.kubernetes : Join node to Kubernetes master] ********************************************************************************************************************************** fatal: [c3bab3b4ba1c.mylabserver.com]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'kubernetes_join_command' is undefined\n\nThe error appears to be in '/home/cloud_user/.ansible/roles/geerlingguy.kubernetes/tasks/node-setup.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Join node to Kubernetes master\n ^ here\n"}

Master.yaml

- hosts: master
  become: true
  vars:
    kubernetes_role: "master"
  roles:
  - geerlingguy.docker
  - geerlingguy.kubernetes
```

Node.yaml
```
- hosts: nodes
  become: true
  vars:
    kubernetes_role: "node"
  roles:
  - geerlingguy.docker
  - geerlingguy.kubernetes
```


command used 
ansible-playbook master.yaml -KK # with sucess no issues
ansible-playbook node.yaml -KK failed with above error

swap is off on node

Thank You

With the way this role currently works, you have to run on both the master and node in the same playbook so the join token can be picked up on the master.