<p>I get this error:</p>
<blockquote>
<p>ERROR! couldn't resolve module/action 'kubernetes.core.k8s'. This often indicates a misspelling, missing collection, or incorrect module path.</p>
</blockquote>
<p>However, I thought I installed it and looks like it is installed:</p>
<pre><code>[me@server ansible]$ ansible-galaxy collection install kubernetes.core
Process install dependency map
Starting collection install process
Skipping 'kubernetes.core' as it is already installed
</code></pre>
<p>The configuration is</p>
<pre><code>[user@server ~]$ ansible --version 
ansible 2.9.25 
config file = /etc/ansible/ansible.cfg 
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] 
ansible python module location = /usr/lib/python3.6/site-packages/ansible 
executable location = /usr/bin/ansible 
python version = 3.6.8 (default, Mar 18 2021, 08:58:41) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
</code></pre>
<p>Than I've tried installing under the <code>root</code> user and under the user I'm running Ansible as and found it did install, but now got this error:</p>
<pre><code>The full traceback is:
Traceback (most recent call last):
  File &quot;/tmp/ansible_kubernetes.core.k8s_payload_yikI_F/ansible_kubernetes.core.k8s_payload.zip/ansible_collections/kubernetes/core/plugins/module_utils/common.py&quot;, line 92, in &lt;module&gt;
    from kubernetes.dynamic.resource import ResourceInstance
ImportError: No module named kubernetes.dynamic.resource
fatal: [1.2.3.4]: FAILED! =&gt; {
    &quot;changed&quot;: false,
    &quot;error&quot;: &quot;No module named kubernetes.dynamic.resource&quot;,
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;api_key&quot;: null,
            &quot;api_version&quot;: &quot;v1&quot;,
            &quot;append_hash&quot;: false,
            &quot;apply&quot;: false,
            &quot;ca_cert&quot;: null,
            &quot;client_cert&quot;: null,
            &quot;client_key&quot;: null,
            &quot;context&quot;: null,
            &quot;continue_on_error&quot;: false,
            &quot;delete_options&quot;: null,
            &quot;force&quot;: false,
            &quot;host&quot;: null,
            &quot;kind&quot;: null,
            &quot;kubeconfig&quot;: null,
            &quot;label_selectors&quot;: null,
            &quot;merge_type&quot;: null,
            &quot;name&quot;: null,
            &quot;namespace&quot;: null,
            &quot;password&quot;: null,
            &quot;persist_config&quot;: null,
            &quot;proxy&quot;: null,
            &quot;proxy_headers&quot;: null,
            &quot;resource_definition&quot;: null,
            &quot;src&quot;: &quot;/home/maasfsr/AnsibleClone/deployments/develop/k8s/neo4j-bolt-pv.yaml&quot;,
            &quot;state&quot;: &quot;present&quot;,
            &quot;template&quot;: null,
            &quot;username&quot;: null,
            &quot;validate&quot;: null,
            &quot;validate_certs&quot;: null,
            &quot;wait&quot;: false,
            &quot;wait_condition&quot;: null,
            &quot;wait_sleep&quot;: 5,
            &quot;wait_timeout&quot;: 120
        }
    },
    &quot;msg&quot;: &quot;Failed to import the required Python library (kubernetes) on K8S-Master's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter&quot;
}
</code></pre>
<p>Is this a different question I should post or related?</p>

Benjamin W Larson
<p>Although you can follow this answer: <a href="https://stackoverflow.com/a/60867449/5508998">https://stackoverflow.com/a/60867449/5508998</a></p>
<p>I found that it only worked when you install those packages using <strong>sudo</strong>, so</p>
<pre><code>sudo pip install openshift pyyaml kubernetes 
</code></pre>
