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

add an example to the kubectl plugin #288

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tpo
Copy link

@tpo tpo commented Nov 18, 2021

SUMMARY

When looking at the kubectl plugin documentation I have no idea how to use the plugin. Having and example helps a lot. Please include an example such as the provided one. Thanks a lot for writing the plugin in the first place!

ISSUE TYPE
  • Docs Pull Request
COMPONENT NAME

kubectl

@gravesm
Copy link
Member

gravesm commented Nov 30, 2021

recheck


tasks:
- name: Get the phpmyadmin Pod name.
command: >
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @tpo. Instead of using kubectl here, can you instead use the kubernetes.core.k8s_info module?

Copy link
Author

@tpo tpo Dec 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gravesm wrote:

Instead of using kubectl here, can you instead use the kubernetes.core.k8s_info module?

I'd like to. I just spent 90 minutes trying to get a simple k8s_info task to run to no avail. Same as with the kubectl plugin: the examples in the k8s_info docu are too dire to allow me to get it to work.

  • Either k8s_info tries to first connect to the master node via ssh and access the k8s API there, which fails, because the credentials to access the API are not available on the node because my management machine is my own PC and not the master node.
  • Or I am trying to get accessing the API from my local PC to work:
- hosts: master-node
  tasks:
    - local_action:
        module: k8s_info
        kind: Pod
        context: my_cluster
        # the following line doesn't seem to have any impact -
        # ansible will still try to connect to the k8s API on localhost
        # kubeconfig: /home/myself/.kube/config
      become: no
      register: pod_list
    - debug: var=pod_list

but am failing because for whatever reason, k8s_info is not accessing my default ~/.kube/config but instead trying to connect to the k8s API at localhost, which obviously fails, because localhost is not in fact a k8s cluster. Nota bene I'm running ansible 2.10 on Debian bullseye here.

So for the time being I'm stopping trying to get k8s_info to work and instead returning to my usual paid job duties again.

That means there are the following ways forward for me with this ticket:

  • a) I get help on how to get k8s_info to work
  • b) at some undefined time in the future I again take some time off from my normal schedule and try to resolve this twisted k8s_info mystery
  • c) we leave the example as is
  • d) I drop the retrieval of pod names from the example (which will obviously make it much less useful - because pod names are usually ephemeral) and put a static pod name into the example instead
  • e) we scratch this pull request
  • f) some other idea

What do you think? Do you have help or a suggestion on how to proceed?

Copy link
Author

@tpo tpo Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately it seems that I am unable to reserve myself time for option b) above during the coming 3 weeks or so. Any opinions on unstalling this pull request with either choice of a) c) d) e) or f) from above?

@gravesm
Copy link
Member

gravesm commented Nov 30, 2021

recheck

2 similar comments
@Akasurde
Copy link
Member

recheck

@Akasurde
Copy link
Member

recheck

@yurnov
Copy link
Contributor

yurnov commented May 27, 2024

I have experience with kubernetes.core.kubectl connection plugin in production, I can create a better example if it help. I agree that looking into current documentation (i.e. for 3.0.0 or 3.1.0 tags) it's not clear how to use connection plugin at all.

@tpo
Copy link
Author

tpo commented May 28, 2024

I have experience with kubernetes.core.kubectl connection plugin in production, I can create a better example if it help.

Thank you, please do

@yurnov
Copy link
Contributor

yurnov commented Jun 1, 2024

Hi @tpo and @gravesm, would you please review #741 that is my attempt to improve collection documentation by adding examples of using the collection plugin. Comment of @gravesm to use k8s_info considered

@tpo
Copy link
Author

tpo commented Jun 2, 2024

Hi @tpo and @gravesm, would you please review #741 that is my attempt to improve collection documentation by adding examples of using the collection plugin. Comment of @gravesm to use k8s_info considered

Thanks a lot for your very nice examples @yurnov - I have reviewed your pull request. If there's some formal syntax to tag your pull request as reviewed by myself then let me know and I can add that as well.

Thanks again, very appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants