In general, not what I wanted, but it suits me: I transferred the
~/.kube/config file from the Kubernetes master to my ansible machine.
The test playbook works great:
- hosts: localhost
module_defaults:
group/k8s:
host: https://192.168.17.167:6443
tasks:
- name: create namespace
k8s:
name: test3namespace
api_version: v1
kind: Namespace
state: present
The topic can be closed.
вторник, 24 ноября 2020 г. в 15:15:22 UTC+3, Андрей Метелкин:
> As I understand it, no one did it?
>
> понедельник, 23 ноября 2020 г. в 11:22:59 UTC+3, Андрей Метелкин:
>
>> I found only a normal description on how to connect AWX and Kubernetes,
>> but I do not understand how to apply this to a regular Ansible.
>>
>> понедельник, 23 ноября 2020 г. в 11:05:08 UTC+3, Андрей Метелкин:
>>
>>> Good afternoon! Thank you so much!
>>> I use this collection when Ansible and Kubernetes are on the same host,
>>> in this scheme I do not experience any problems. I am interested in
>>> understanding how to connect to API Kubernetes, I did not find a sane
>>> description.
>>>
>>> пятница, 20 ноября 2020 г. в 05:46:01 UTC+3, Abhijeet Kasurde:
>>>
>>>> Hi
>>>>
>>>> There is already a collection to deal with Kubernetes.
>>>>
>>>> 1. community.kubernetes (kubernetes.core) -
>>>> https://github.com/ansible-collections/community.kubernetes
>>>> 2. community.okd (for OKD and OpenShift) -
>>>> https://github.com/ansible-collections/community.okd
>>>>
>>>> You can check out the code implemented in the module_utils.
>>>>
>>>> Let me know if you have any questions.
>>>>
>>>> On Thu, Nov 19, 2020 at 9:02 PM Андрей Метелкин <[email protected]>
>>>> wrote:
>>>>
>>>>> I want to connect to API Kubernetes with Ansible. Ansible and
>>>>> Kubernetes are installed on different hosts. Unfortunately, I cannot find
>>>>> a
>>>>> normal description of how this works.
>>>>> Please help with links to manuals where the process is described in
>>>>> detail.
>>>>>
>>>>> 1) I want to understand if it is possible to create a key and a token
>>>>> by which I will easily connect to the API. I want to understand whether
>>>>> it
>>>>> is possible to create a key and a token without being bound to any
>>>>> namespace or service account.
>>>>> 2) I want to understand how to create a key and a token in Kubernetes
>>>>> that ansible can use.
>>>>> 3) I want to understand where to store the key and token on the
>>>>> ansible side. I want to understand where in the playbook to specify the
>>>>> key
>>>>> and token.
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Ansible Project" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/ansible-project/282e2245-35b8-4f3d-8c6b-84c9181afc6an%40googlegroups.com
>>>>>
>>>>> <https://groups.google.com/d/msgid/ansible-project/282e2245-35b8-4f3d-8c6b-84c9181afc6an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>
>>>>
>>>> --
>>>> Thanks,
>>>> Abhijeet Kasurde
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/5e941460-e195-4cdd-865f-34e45bf584c8n%40googlegroups.com.