kubernetes-sigs / kubespray

Deploy a Production Ready Kubernetes Cluster
Apache License 2.0
16.06k stars 6.45k forks source link

kubectl_localhost get wrong binary when ansible host arch is different from deployed cluster #11608

Open noama-nv opened 1 week ago

noama-nv commented 1 week ago

What happened?

when enable kubectl_localhost and ansible host arch is x86_64 and deploy a kubernetes cluster on aarch64 systems it copy the binary from the host.

binary from aarch64 host is not got for x86_64 ansible host error: kubectl: cannot execute binary file: Exec format error1

https://github.com/kubernetes-sigs/kubespray/blob/master/roles/kubernetes/client/tasks/main.yml#L90

What did you expect to happen?

when kubectl_localhost enable download correct arch binary to the ansible host

How can we reproduce it (as minimally and precisely as possible)?

1x ansible host x86_64 arch 1x controller node aarch64 arch

deploy kubespray with kubectl_localhost

OS

Ubuntu2204

Version of Ansible

2.17.0

Version of Python

3.11

Version of Kubespray (commit)

master

Network plugin used

calico

Full inventory with variables

*

Command used to invoke ansible

ansible-playbook -i inventory/arm/hosts.yaml cluster.yml

Output of ansible run

*

Anything else we need to know

No response

leeonfu commented 1 week ago

beautiful

tico88612 commented 3 days ago

/help

k8s-ci-robot commented 3 days ago

@tico88612: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to [this](https://github.com/kubernetes-sigs/kubespray/issues/11608): >/help Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
leeonfu commented 2 days ago

/assign

leeonfu commented 2 days ago

Hi @noama-nv Through my test, I think yaml for 'https://github.com/kubernetes-sigs/kubespray/blob/master/roles/kubernetes/client/tasks/main.yml#L90' will not be executed; it should be executed only if kubectl_localhostis true.

roles/kubespray-defaults/defaults/main/main.yml:385:kubectl_localhost: false roles/kubernetes/client/tasks/main.yml:101: when: kubectl_localhost roles/kubernetes/client/tasks/main.yml:114: when: kubectl_localhost and kubeconfig_localhost roles/kubernetes/client/defaults/main.yml:4:kubectl_localhost: false roles/kubernetes-apps/krew/tasks/main.yml:10: when: kubectl_localhost ~/kubespray$ grep -ri -n kubectl_localhost playbooks/ ~/kubespray$ grep -ri -n kubectl_localhost inventory/mycluster/ inventory/mycluster/group_vars/k8s_cluster/k8s-cluster.yml:251:# kubectl_localhost: false

So do you have any other custom configurations on here?

Br, Leeon