<p>i installed the community kubernetes collection (<a href="https://galaxy.ansible.com/community/kubernetes" rel="nofollow noreferrer">https://galaxy.ansible.com/community/kubernetes</a>)</p>
<p>run <code>ansible-galaxy collection install community.kubernetes</code> on my ansible machine and have this task to use the module:</p>
<pre><code>- name: Create a dashboard service account
  kubernetes.core.k8s:
    kubeconfig: &quot;{{ hostvars['master'].kubeconfig }}&quot;
    state: present
    resource_definition:
      kind: ServiceAccount
      apiVersion: v1
      metadata:
        name: admin-user
        namespace: kubernetes-dashboard
</code></pre>
<p>and thats the output:</p>
<pre><code>fatal: [master]: FAILED! =&gt; {&quot;msg&quot;: &quot;Could not find imported module support code for ansiblemodule.  Looked for either AnsibleTurboModule.py or module.py&quot;}
</code></pre>
<p>ansible version:</p>
<pre><code>ansible 2.9.9
  config file = /home/xx/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
</code></pre>
<p>OS:</p>
<pre><code>PRETTY_NAME=&quot;Debian GNU/Linux 10 (buster)&quot;
NAME=&quot;Debian GNU/Linux&quot;
VERSION_ID=&quot;10&quot;
VERSION=&quot;10 (buster)&quot;
VERSION_CODENAME=buster
ID=debian
HOME_URL=&quot;https://www.debian.org/&quot;
SUPPORT_URL=&quot;https://www.debian.org/support&quot;
BUG_REPORT_URL=&quot;https://bugs.debian.org/&quot;
</code></pre>
<p>what do i need to fix this problem?</p>
<p>if you need more informations, let me know!</p>

<p>I had this issue as well. Tracked it down to having not very well documented dependencies. The new <a href="https://github.com/ansible-collections/kubernetes.core" rel="nofollow noreferrer">kubernetes.core</a> ansible package has a number of dependencies. The error you are getting is because of the AnsibleTurbo package. Even though the playbook doesn't use it by default, there is a reference that is unsatisfied. The following need to be installed on the host where your playbook is run:</p>
<pre><code>ansible-galaxy collection install community.kubernetes
ansible-galaxy collection install cloud.common
</code></pre>
<p>That should solve the core problem you are having. You may run into another, where the kuberentes python API package needs to be installed on the targets.</p>
<p>Note: depending on how you define your hosts, you'll only need to install the pip package if you are trying to interact with the k8s API <em>through</em> the defined host. Installing the package locally and telling the k8s module to use localhost as the target should result in success if you have your kubeconfig locally, pointing to the remote cluster.</p>
<p>Here is what I added to my playbook to get the k8s module to work with the remotes:</p>
<pre><code>- name: ensure python3 is installed
  become: yes
  ansible.builtin.package:
    name:
      - python3
      - python3-pip
    state: present

- name: install kubernetes pip package
  pip:
    name: kubernetes
    state: present
</code></pre>
