Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove_node.yml does not work - No kubernetes.core.k8s module in Ansible 2.9 #8280

Closed
Shabahang opened this issue Dec 8, 2021 · 5 comments · Fixed by #8287
Closed

remove_node.yml does not work - No kubernetes.core.k8s module in Ansible 2.9 #8280

Shabahang opened this issue Dec 8, 2021 · 5 comments · Fixed by #8287
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@Shabahang
Copy link

Shabahang commented Dec 8, 2021

Environment:

  • Cloud provider or hardware configuration:
    On-premise

  • OS (printf "$(uname -srm)\n$(cat /etc/os-release)\n"):

Linux 3.10.0-1160.el7.x86_64 x86_64
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
  • Version of Ansible (ansible --version):
    ansible 2.9.16
    ansible python module location = /usr/local/lib/python3.6/site-packages/ansible

  • Version of Python (python --version):
    python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

Kubespray version (commit) (git rev-parse --short HEAD):
4ef2cf4

Network plugin used:
calico

Full inventory with variables (ansible -i inventory/sample/inventory.ini all -m debug -a "var=hostvars[inventory_hostname]"):

Command used to invoke ansible:
ansible-playbook -i inventory/<CLUSTER_NAME>/hosts.yaml remove-node.yml -e node=node1

Output of ansible run:


`ERROR! couldn't resolve module/action 'kubernetes.core.k8s'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/root/kubespray/roles/remove-node/remove-etcd-node/tasks/main.yml': line 67, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

# Delete node from kubeadm-config
- name: Update kubeadm-config configmap removing control-plane no longer existing endpoints
  ^ here
`

Anything else do we need to know:
Using Ansible 2.9 fails running remove-node.yml.
in version 2.9 there is no kubernetes.core.k8s module, while 2.9 is a supported versions.

@Shabahang Shabahang added the kind/bug Categorizes issue or PR as related to a bug. label Dec 8, 2021
@cristicalin
Copy link
Contributor

Broken by #8244

/cc @Alvaro-Campesino

@Alvaro-Campesino
Copy link
Contributor

Hi,

I am checking it, I am realizing I tested it with ansible 2.10 which has moved into the kubernetes.core.k8s module

I could manage it with a command instead of using the k8s module or the kubernetes.core.k8s module.

Not sure right now if k8s is there by default. I will check on it.

@floryut
Copy link
Member

floryut commented Dec 9, 2021

What about using the https://github.com/kubernetes-sigs/kubespray/blob/master/library/kube.py plugin ?

Like

kube:
name: "MetalLB"
kubectl: "{{ bin_dir }}/kubectl"
filename: "{{ kube_config_dir }}/{{ item.item }}"
state: "{{ item.changed | ternary('latest','present') }}"

@Alvaro-Campesino
Copy link
Contributor

Alvaro-Campesino commented Dec 9, 2021 via email

@Alvaro-Campesino
Copy link
Contributor

Well @floryut , I am checking kube does not support configmaps or operations not meant for creating, replacing or deleting the supported resources. So it makes it difficult to make a lookup of a configmap in order to update it.

Meaning that the best approach without updating this plugin, which will lead to it doing same things done by kubernetes.core.k8s , is to use command. Not really happy with any of the options (updating the plugin or using command, i will think about it over the weekend). I guess I will end up tangling the kube.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants