geerlingguy / geerlingguy/ansible-for-devops
The task includes an option with an undefined variable. The error was: 'kubernetes_join_command' is undefined
- Dominant language
- Python
- Stars
- 9.9k
- Forks
- 3.8k
- PR merge metrics
- No merged PRs in 30d
Description
Following the kubernetes example and I kept getting this error on the geerlingguy.kubernetes : Join node to Kubernetes master task:
`fatal: [node1]: 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/enda/Documents/ansible-for-devops/kubernetes/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"}
fatal: [node2]: 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/enda/Documents/ansible-for-devops/kubernetes/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"}`
During this time I was also getting this error on [geerlingguy.kubernetes : Initialize Kubernetes master with kubeadm init and ignore_preflight_errors]:
`fatal: [master]: FAILED! => {"changed": true, "cmd": ["kubeadm", "init", "--config", "/etc/kubernetes/kubeadm-kubelet-config.yaml", "--ignore-preflight-errors=all"], "delta": "0:00:00.018542", "end": "2022-04-29 16:26:30.017344", "msg": "non-zero return code", "rc": 1, "start": "2022-04-29 16:26:29.998802", "stderr": "W0429 16:26:30.016270 14047 strict.go:47] unknown configuration schema.GroupVersionKind{Group:\"kubeadm.k8s.io\", Version:\"v1beta2\", Kind:\"InitConfiguration\"} for scheme definitions in \"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme/scheme.go:31\" and \"k8s.io/kubernetes/cmd/kubeadm/app/componentconfigs/scheme.go:28\"\nno kind \"InitConfiguration\" is registered for version \"kubeadm.k8s.io/v1beta2\" in scheme \"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme/scheme.go:31\"", "stderr_lines": ["W0429 16:26:30.016270 14047 strict.go:47] unknown configuration schema.GroupVersionKind{Group:\"kubeadm.k8s.io\", Version:\"v1beta2\", Kind:\"InitConfiguration\"} for scheme definitions in \"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme/scheme.go:31\" and \"k8s.io/kubernetes/cmd/kubeadm/app/componentconfigs/scheme.go:28\"", "no kind \"InitConfiguration\" is registered for version \"kubeadm.k8s.io/v1beta2\" in scheme \"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme/scheme.go:31\""], "stdout": "", "stdout_lines": []}
`
A similar error was encountered in this comment: https://github.com/geerlingguy/ansible-for-devops/issues/108#issuecomment-455028251 and the solution at that time was to upgrade to k8s 1.13
To get this working I upgraded to k8s 1.19 and updated the clusterRole api definition to rbac.authorization.k8s.io/v1 and the DaemonSet api definition to apps/v1.
Also had to set the spec.selector for DaemonSet as per https://kubernetes.io/docs/reference/using-api/deprecation-guide/#daemonset-v116
Running using the virtualbox vagrant provider on Fedora 35.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with roles/geerlingguy.kubernetes/tasks/node-setup.yml and the kubeadm init task that reads /etc/kubernetes/kubeadm-kubelet-config.yaml. Reproduce the example with the reported Kubernetes and Fedora 35 versions, then compare the kubeadm configuration and generated join command. Done means the master initializes and node1/node2 join without undefined-variable or API-version errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100