ansible-collections / community.kubernetes

Kubernetes Collection for Ansible
https://galaxy.ansible.com/community/kubernetes
GNU General Public License v3.0
265 stars 104 forks source link

Add example k8s usage to apply manifest from URL #352

Closed geerlingguy closed 3 years ago

geerlingguy commented 3 years ago
SUMMARY

Today I wanted to apply the official metrics-server manifest from a URL instead of from a local file or a file copied to my remote Kubernetes cluster server.

I noticed the documentation lacks any examples of URL-based deployments, so I think we should add an example to show how to do it.

Then I realized I'm not even sure if there's a way using a lookup with url or any other way to directly apply a manifest from a URL... here's how I'm doing it in my current playbook:

- name: Download metrics-server manifest to the cluster.
  get_url:
    url: https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
    dest: ~/metrics-server.yaml
    mode: '0664'

- name: Apply metrics-server manifest to the cluster.
  k8s:
    state: present
    src: ~/metrics-server.yaml

So... first of all is it possible to apply direct from a URL? And if not, maybe we at least document how to do it this way (download, then apply).

ISSUE TYPE
COMPONENT NAME

k8s

ANSIBLE VERSION

Any.

Akasurde commented 3 years ago

@geerlingguy For now, I documented the current way of downloading and applying the manifest. In near future we may consider adding this functionality. PR welcome.

Akasurde commented 3 years ago

resolved_by_pr #359